![]() |
Open workbook with password in VBA
I have saved several workbooks in a directory that are password protected. Using the following code, How do I tell it to use the password when it opens the file? MyPath is the directory path MyFiles(Fnum) is the workbook name. This is an array of workbook names all using the same password. Set mybook = Workbooks.Open(MyPath & MyFiles(Fnum)) Thanks Shawn G. |
Open workbook with password in VBA
Try this...
Set mybook = Workbooks.Open(Filename:=MyPath & MyFiles(Fnum), _ Password:="MyPassword") -- HTH... Jim Thomlinson "Shawn G." wrote: I have saved several workbooks in a directory that are password protected. Using the following code, How do I tell it to use the password when it opens the file? MyPath is the directory path MyFiles(Fnum) is the workbook name. This is an array of workbook names all using the same password. Set mybook = Workbooks.Open(MyPath & MyFiles(Fnum)) Thanks Shawn G. |
Open workbook with password in VBA
Thank You!!! Worked Perfectly!
"Jim Thomlinson" wrote: Try this... Set mybook = Workbooks.Open(Filename:=MyPath & MyFiles(Fnum), _ Password:="MyPassword") -- HTH... Jim Thomlinson "Shawn G." wrote: I have saved several workbooks in a directory that are password protected. Using the following code, How do I tell it to use the password when it opens the file? MyPath is the directory path MyFiles(Fnum) is the workbook name. This is an array of workbook names all using the same password. Set mybook = Workbooks.Open(MyPath & MyFiles(Fnum)) Thanks Shawn G. |
All times are GMT +1. The time now is 10:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com