ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   open excel spreadsheet with password (https://www.excelbanter.com/excel-programming/333723-open-excel-spreadsheet-password.html)

rocket0612[_3_]

open excel spreadsheet with password
 

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


moi

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





All times are GMT +1. The time now is 07:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com