How to Open file as read only

G

Guest

I want to open a file as read only and get some data from. However when I use
the follwoing code and someone already has the file open, it is as if I
never specified read only in the VBA Code.

If Dir(MyPath & LE_Actuals & "\" & Arr(i)) <> "" Then
Workbooks.Open (MyPath & LE_Actuals & Arr(i)), 0, ReadOnly = True
ActiveWorkbook.Windows(1).Visible = False
 
T

Tom Ogilvy

as written you are comparing the uninitialized variable ReadOnly to the
boolean value True. For named arguments you use colon equal

ReadOnly:=True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top