Open Multiple Password-Protected Linked Excel Workbooks with VBA
Question details
Open multiple password-protected, linked Excel workbooks automatically using VBA.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user wants to open linked workbooks with their passwords and update links in a master workbook.
- Observed behavior
- Each protected workbook should open with its own password, and the master workbook should update its external links.
Identify the full paths and open passwords for each workbook, and determine which files are link sources. Run the macro from an accessible macro-enabled workbook; if the macro is inside a protected workbook, that workbook must be opened first.
Open each linked workbook with its password in VBA
Use a separate Workbooks.Open call for each protected file, opening link sources before the master workbook.
The Password argument supplies the password required to open a workbook. UpdateLinks:=3 requests updates to external links, but it does not supply passwords to other protected workbooks.
The sample uses password placeholders for clarity. Do not leave actual passwords in shared VBA code; use an appropriate secure credential method for your environment.
In Excel, open an accessible macro-enabled workbook, press Alt+F11, and choose Insert > Module.
Paste this example into the module: Sub OpenLinkedWorkbooks() Workbooks.Open Filename:="C:\Files\Source.xlsx", UpdateLinks:=0, Password:="SOURCE_PASSWORD" Workbooks.Open Filename:="C:\Files\Master.xlsx", UpdateLinks:=3, Password:="MASTER_PASSWORD" End Sub
Replace each Filename value with the actual file path and provide the matching open password. Add another Workbooks.Open statement for each additional source file, before the master workbook statement.
Save the macro in an .xlsm workbook, run OpenLinkedWorkbooks from the VBA editor, and check the master workbook's linked values. Enable macros only if you trust the code.

Work with Excel spreadsheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Microsoft Office format support for a smoother move between office suites. Excel VBA automation may not work the same way in WPS, so use Excel for the macro solution above.

Frequently Asked Questions
Can I use the same password for every workbook?
Yes. Pass the same password value to the Password argument in each Workbooks.Open statement. Each workbook still needs its own call.
Why should I open source workbooks before the master workbook?
Opening the protected sources first makes them available when the master workbook opens and requests link updates with UpdateLinks:=3.
Does UpdateLinks:=3 provide passwords for linked files?
No. It requests external link updates; use a separate Workbooks.Open call with the appropriate Password argument for each protected workbook.
Can I store the macro in an XLSX file?
No. Save the workbook containing the macro as an Excel Macro-Enabled Workbook (.xlsm) using File > Save As.




