PDA

View Full Version : [SOLVED] Macro's that open files with passwords



Mr Mike
07-25-2005, 02:57 PM
I want this macro enter a password when opening file... but my skills don't beyond using the macro recorder to learn the syntax, and the macro recorder doesn't pick up entering passwords.

As a result, the macro halts when it reaches the password prompt.

The sequence you see below is repeated about 20 times for updating different files/reports.


Workbooks.Open Filename:= _
"F:\Agenda\Store Performance By Division - A.xls" _
, UpdateLinks:=3
Application.Run "'Store Performance By Division - A.xls'!UpdateSPBD"
ActiveSheet.Previous.Select
Range("C10").Select
ActiveWorkbook.Save
ActiveWindow.Close

Thanks for your help!

MOS MASTER
07-25-2005, 03:09 PM
Hi, :yes

You didn't mention what type of password but I presume the one for opening.

Change line:


Workbooks.Open Filename:= _
"F:\Agenda\Store Performance By Division - A.xls" _
, UpdateLinks:=3


to:


Workbooks.Open Filename:= _
"F:\Agenda\Store Performance By Division - A.xls" _
, Password:="YourPassWord", UpdateLinks:=3


HTH, :whistle:

Mr Mike
07-25-2005, 03:19 PM
Excellent. Thanks MOS

MOS MASTER
07-25-2005, 03:45 PM
Your welcome! :yes

And a late Welcome to VBAX! :hi: (missed it the first time)