Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening Password Protected Workbooks

Status
Not open for further replies.

MyFlight

Technical User
Feb 4, 2002
193
Help,

I need to Open a Password Protected Workbook.
It has both Read-Only Password (Password1234) and Modify-Password (Password5678), enabled.

Everytime I try to open it it always opens as READ-ONLY.

Here is the Script I have. Any Help would be appreciated.

Sub MainMacro()
'

'
Dim filename As String
Dim WB As Workbook

filename = "\\Passwords\Passwords.xls"

Set WB = Workbooks.Open(filename, , False, , "Password1234", "Password5678")

Windows("IBM Passwords.xls").Activate

ActiveWindow.WindowState = xlMaximized

End Sub

 
I can't duplicate the error using a non-network destination (i.e. I used c:\ instead of \\). I also assumed that "IBM Passwords.xls" is either the workbook with the macro or another workbook that is open at the time.

It worked OK. Maybe it's something to do with the network path or the workbook being on a network path. Can you map it to a drive and try it again?

Let me know what happens.

Scott
 
have you checked if you do have rights to modify files on the network share/folder?

try copying the file to a local drive and trying the code there

if your code works on the copy in your local drive then you do not have sufficient rights on the network share/folder
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top