Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default PASSWORD PICK UP WHILE FILE OPEN

I would like to enter password in the program instead of entering everytime
on file open. I need to open several files in which same password is used.
How to do in programatically enter a password while file open?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default PASSWORD PICK UP WHILE FILE OPEN

Do you open all these files at once?

If yes, you could create a new workbook that only serves to open the others
(while supplying the password):

Option Explicit
Sub testme()

Dim myFileNames As Variant
Dim myPWD as String
Dim iCtr As Long

'put all workbook names here
myFileNames = Array("C:\my documents\excel\book1.xls", _
"C:\my documents\excel\book2.xls", _
"C:\my documents\excel\book3.xls")

myPWD = "TopSeCreTPAssWordHerE!"

For iCtr = LBound(myFileNames) To UBound(myFileNames)
On Error Resume Next
Workbooks.Open Filename:=myFileNames(iCtr), Password:=myPWD
If Err.Number < 0 Then
MsgBox myFileNames(iCtr) & " didn't open" & vbLf & "Quitting!"
Err.Clear
Exit Sub
End If
Next iCtr
End Sub

Vijay Kotian wrote:

I would like to enter password in the program instead of entering everytime
on file open. I need to open several files in which same password is used.
How to do in programatically enter a password while file open?


--

Dave Peterson
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
Can not open the Password file vishu Excel Discussion (Misc queries) 0 March 24th 10 08:48 AM
open ftp file with password Kevin Excel Worksheet Functions 1 September 5th 07 05:02 PM
PASSWORD REMOVAL I have the password to open the file and the password to modify the file now how to remove them LJ[_4_] Excel Programming 0 April 27th 06 03:18 AM
Password to open file dcknie Excel Discussion (Misc queries) 3 June 29th 05 03:49 PM
Open file without Password Steph[_3_] Excel Programming 1 October 26th 04 08:53 AM


All times are GMT +1. The time now is 12:12 PM.

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"