This may give you an idea for your problem. I use it to open a password
protected workbook from another open workbook, where both are in the same
folder. It then runs a macro that resides in the protected workbook within a
general code module.
Sub RunTracking()
Dim cdir As String
Dim wb As Workbook
For Each wb In Workbooks
If wb.name = "NCP Tracking.xls" Then
MsgBox ("NCP Tracking.xls is already open.")
Exit Sub
End If
Next wb
cdir = ActiveWorkbook.Path
Workbooks.Open cdir & "\NCP Tracking.xls", password:="NCP"
Application.Run ("'NCP Tracking.xls'!RunUpdate")
End Sub
Good Luck,
Mike F
"funkymonkUK"
wrote in message
...
Hi
I have a workbook which when I open the document it comes up saying
"Password" workbook is reserved by somebody" please enter in password"
is there a way to create a macro which would enter in the password then
press enter to open the workbook? I will be running this macro from a
separate workbook and I know the password.
--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile:
http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=552161