Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default 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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Password to open workbook Trainee Excel Discussion (Misc queries) 2 December 17th 09 07:17 PM
I know my password, yet it will not open my workbook GIB Excel Worksheet Functions 1 March 25th 09 06:23 PM
need to open my workbook not asking for password so i can do so Christine[_2_] Excel Discussion (Misc queries) 0 October 4th 07 10:31 PM
Open en close a workbook with password Morrigu Excel Programming 1 April 16th 04 04:37 PM
Open a password protected excel workbook from second workbook to fetch data using dynamic connection kaustav choudhury Excel Programming 2 April 3rd 04 06:18 AM


All times are GMT +1. The time now is 06:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"