VBA Open Workbook as Read-only

If you want to use the VBA code to open a workbook in read-only mode, you have to follow these steps.

  1. Open an Excel workbook.
  2. Open the VBA editor by using the Alt + F11 keyboard shortcut.
  3. Enter the following code.
  1. Create the file called excel_file.xlsx on the C drive (or any other path. Just remember to change the code accordingly).
  2. Run the code.
  3. Now, you have the file opened in a new window.
  1. As you can see, next to the file name there is the information that this file is opened in the read-only.

Tomasz Decker is an Excel specialist, skilled in data analysis and financial modeling.

Posted in vba