Excel Macro to open password protected workbooks?

G

Guest

I've got a macro that opens other Excel workbooks to pull specific data that
constantly changes. These workbooks are password protected. Is there language
I can put in the macro to fill the password field? Right now when I run the
macro, I need to manually enter the password for each workbook that the macro
opens.

Thanks!
Darren
 
G

Guest

One suggestion: record a macro during which you force a password-protected
workbook to open and see what code XL puts in for such an action. Then use
that.

Dave
 
D

Dave Peterson

Take a look at VBA's help for workbooks.open.

Workbooks.Open Filename:="C:\my documents\excel\book1.xls", _
Password:="PWD111"
 
G

Guest

I couldn't get the password to work, however I was able to change the
workbooks that were protected to be read only. I could then open the
workbooks with the following string without having to manually click 'Read
Only'.

Thanks for your help!!

Workbooks.Open "C:\my documents\excel\book1.xls", , True
 

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