ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I select "Read Only" (https://www.excelbanter.com/excel-programming/408508-how-do-i-select-read-only.html)

iashorty

How do I select "Read Only"
 
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?

Jim Thomlinson

How do I select "Read Only"
 
Workbooks.Open Filename:="C\Text.xls", ReadOnly:=True, _ Password:="MyPassword"
--
HTH...

Jim Thomlinson


"iashorty" wrote:

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?


Tom Hutchins

How do I select "Read Only"
 
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

"iashorty" wrote:

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?


iashorty

How do I select "Read Only"
 
Thanks Jim. It worked beautifully.

"Jim Thomlinson" wrote:

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

Jim Thomlinson


"iashorty" wrote:

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?


iashorty

How do I select "Read Only"
 
Thanks, Tom. Indeed it was the first item.


"Tom Hutchins" wrote:

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

"iashorty" wrote:

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?



All times are GMT +1. The time now is 09:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com