Opening Workbook as Read Only and using ".Activate"
Set NewBk = Workbooks.Open(FileDir & FilesInPath , ReadOnly:=True, _
Password:="Metrics")
NewBk.Activate
It is not recommended to use SELECT or ACTIVATE method it slows down the
code and switches sheets when it is not necessary. It is better to refer to
the book by its set name
"John Brenner" wrote:
I have code that opens the file and activates it:
Workbooks.Open(FileDir & FilesInPath).Activate
But I want to combine this with arguments that will open the file as read
only:
Workbooks.Open(FileDir & FilesInPath).Activate , ReadOnly:=True, _
Password:="Metrics"
This line gives me an error "invalid number of arguments".
Is it possible to open as active as read-only?
Thanks -
--
Regards,
John
|