Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hard Code Password into File Open

Status
Not open for further replies.

MrsTFB

MIS
Oct 3, 2000
307
US
I have the code below:
Workbooks.Open Filename:="F:\charts\HR-EPA WORKBOOK.xls"


It is a password protected file, but I want the code to operate without the need for the password. It is going to open, write to it, then close it all within the code. It prompts for password still.
I know this is simple coding, but I'm not familiar.

Thanks for any help!

MrsTFB
 
I have found this explanation, but don't exactly understand it.

Password Optional Variant. A string that contains the password required to open a protected workbook. If this argument is omitted and the workbook requires a password, the user is prompted for the password.


MrsTFB
 
Try this:
Workbooks.Open Filename:="F:\charts\HR-EPA WORKBOOK.xls",Password:="YOUR PASSWORD HERE"
 
The file is password protected. That means a password is required. The fact you want to open it, write to it, close it, by code is irrelevant. The file requires a password to open.

The Open method allows you to pass a password in as an argument. But if you don't - and the file IS password protected - then you get prompted for the password.

Why? Because the file is password protected.
It is a password protected file, but I want the code to operate without the need for the password.

What would be the point of a password protected file if you could simply ignore it because you want code to operate without it?

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top