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
|