Tuesday, July 12, 2005

VBA open files that are read only

I use the Workbooks.Open filename command to open files in VBA. However for files that have been saved with Read Only turned on I haven't been able to figure out how to open them in Write mode.
The help file helpfully says how to open them in Read Only Mode using this syntax:
Workbooks.Open FileName:="Array.xls", ReadOnly:=True

However using the ReadOnly:=False option does not seem to make any difference; the file still opens as read only.

If anyone knows how to open Read Only files in Write mode please let me know.
At the moment I have resorted to allowing the "Do you want to open as Read Only?" dialog box to display and click No in each instance. This is frustrating when manipulating a large number of files consecutively.