i need to auto-open my password protected excel file in my computer through vba.
i will save my excel file with default password.
vba macro should open this my file automatically with default password (which can be included in vba).
i need to auto-open my password protected excel file in my computer through vba.
i will save my excel file with default password.
vba macro should open this my file automatically with default password (which can be included in vba).
Hi
You've not given a great deal of info on exactly what you mean but perhaps something like this will give you a start.
Is this what you mean?Sub OpenBookTest() Dim myFile As String Dim myPath As String myPath = "C:\My Documents" myFile = "My Workbook.xls" Workbooks.Open myPath & "\" & myFile, password:="password" End Sub
Regards
Iain - XL2010 on Windows 7
glaswegian, thanku for ur reply,
I hv solved my solution like this...
I hv created two toolbar icon namely "Lock file" and "Unlock file"...
[VBA]
Sub LockFile()
'
ActiveWorkbook.Password = "123"
ActiveWorkbook.WritePassword = "123"
End Sub
Sub UnlockFile()
'
ActiveWorkbook.Password = ""
ActiveWorkbook.WritePassword = ""
End Sub
[/VBA]
Hi
If you want to open a worksheet
this is the way :
Worksheets(i).Unprotect Password:="456"