View Full Version : Solved: auto open password protected excel file
ilyaskazi
04-04-2005, 07:00 AM
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).
Glaswegian
04-04-2005, 07:39 AM
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.
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
Is this what you mean?
Regards
ilyaskazi
04-06-2005, 07:49 PM
glaswegian, thanku for ur reply,
I hv solved my solution like this...
I hv created two toolbar icon namely "Lock file" and "Unlock file"...
Sub LockFile()
'
ActiveWorkbook.Password = "123"
ActiveWorkbook.WritePassword = "123"
End Sub
Sub UnlockFile()
'
ActiveWorkbook.Password = ""
ActiveWorkbook.WritePassword = ""
End Sub
sharonfin
08-31-2011, 10:05 AM
Hi
If you want to open a worksheet
this is the way :
Worksheets(i).Unprotect Password:="456"
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.