View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
moi moi is offline
external usenet poster
 
Posts: 27
Default open excel spreadsheet with password

Sub OpenProtectedFile()
Dim wb As Workbook
Dim ws As Worksheet
Set wb = Workbooks.Open("C:\Password Protected File.xls", , , ,
"password1", "password2")
Set ws = wb.Sheets("Sheet1")
ws.Activate
ws.Cells(1, 1).Value = "Modified by VBA"
End Sub

"rocket0612"
schreef in bericht
...

When using a macro to open a spreadsheet, if the spreadsheet is password
protected & I know what the password is, what code would I use to open
the spreadsheet with the password?

thanks


--
rocket0612
------------------------------------------------------------------------
rocket0612's Profile:
http://www.excelforum.com/member.php...o&userid=19492
View this thread: http://www.excelforum.com/showthread...hreadid=384808