How do I select "Read Only"

I

iashorty

I am writing a macro that needs to open another file that is password
protected in "Read Only", copy a sheet into my current file and close the
file I am copying from. How do I write the string to select "Read Only" from
the password window?
 
J

Jim Thomlinson

Workbooks.Open Filename:="C\Text.xls", ReadOnly:=True, _ Password:="MyPassword"
 
T

Tom Hutchins

If you want to open the file in read-only mode, ReadOnly is one of the
options for the Workbooks.Open method:

Workbooks.Open Filename:="D:\Data\book1.xls", _
Password:="abc", ReadOnly:=True

If you meant that the workbook was save with the read-only recommnded
option, you can tell Excel not to display the read-only recommended message:

Workbooks.Open Filename:="D:\Data\book1.xls", _
Password:="abc", IgnoreReadOnlyRecommended:=True

Hope this helps,

Hutch
 
I

iashorty

Thanks, Tom. Indeed it was the first item.


Tom Hutchins said:
If you want to open the file in read-only mode, ReadOnly is one of the
options for the Workbooks.Open method:

Workbooks.Open Filename:="D:\Data\book1.xls", _
Password:="abc", ReadOnly:=True

If you meant that the workbook was save with the read-only recommnded
option, you can tell Excel not to display the read-only recommended message:

Workbooks.Open Filename:="D:\Data\book1.xls", _
Password:="abc", IgnoreReadOnlyRecommended:=True

Hope this helps,

Hutch
 

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

Top