[excel] How do I open workbook programmatically as read-only?

This is how I can open an excel file in vbA:

Workbooks.Open(file-path)

is there a way to specify that it should be open as read-only? The files I am opening have a password on them, and I always get the dialog that it can only be open as read only.

This question is related to excel vba

The answer is


Check out the language reference:

http://msdn.microsoft.com/en-us/library/aa195811(office.11).aspx

expression.Open(FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter, AddToMru, Local, CorruptLoad)