VBA & Macro Problems

Open Multiple Password-Protected Linked Excel Workbooks with VBA

Aamir Naveed AkramAamir Naveed Akram Nov 20, 2026 870 views

Question details

Open multiple password-protected, linked Excel workbooks automatically using VBA.

Open Multiple Password-Protected Linked Excel Workbooks with 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.
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA editor

In Excel, open an accessible macro-enabled workbook, press Alt+F11, and choose Insert > Module.

2
Add the opening macro

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

3
Set paths and credentials

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.

4
Run and check the links

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.

Open each linked workbook with its password in VBA
Use the correct password: Password is for opening the file. It is different from a worksheet protection password or a VBA project password.
Free Microsoft Office alternative

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.

Open and work with spreadsheet data in WPS SpreadsheetsSupports Microsoft Excel formats including XLSX and XLSFamiliar interface for everyday spreadsheet tasksFree and lightweight office suite
microsoft office alternative - wps office

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.