File Format & Compatibility

How to Preserve External Workbook Links in Excel Defined Names

John WilsonJohn Wilson Nov 10, 2026 869 views

Question details

The user needs a method to prevent external links stored in defined names from disappearing from the LinkSources collection after executing a macro.

How to Preserve External Workbook Links in Excel Defined Names
Product
Microsoft Excel
Device & OS
not provided
Scenario
Processing defined names containing external workbook links via an Excel macro.
Observed behavior
External links stored only in defined names disappear from Excel's LinkSources collection after macro processing, even though the references remain visible in the Name Manager.
Before you start

Before making changes to external links and defined names, ensure you save a backup copy of your workbook. This protects your original data while testing the macro and reference updates.

Solution 1Recommended

Add Explicit Worksheet References

Adding a direct cell reference to the external workbook forces Excel to recognize and retain the link in its LinkSources collection.

Excel sometimes struggles to track external links if they are exclusively stored within the Name Manager. When a macro processes these names, the connection in the LinkSources collection may break, causing missing data or VBA errors.

To solve this behavior, you can manually establish an explicit connection to the external file directly on a worksheet. This forces Excel's LinkSources property to recognize and preserve the connection permanently.

1
Open a dedicated worksheet

Open your main workbook and navigate to a blank or dedicated worksheet. You can choose to hide this sheet later so it doesn't interfere with your main data.

2
Create a direct reference

Select an empty cell, type `=`, and navigate to the open external workbook. Click on any cell (e.g., `Sheet1!A1`) and press Enter to create an explicit reference such as `='[ExternalWorkbook.xlsx]Sheet1'!A1`.

3
Repeat for all external files

Repeat this process to create one explicit reference for every external workbook that your defined names rely on.

4
Save and test

Save the workbook and run your macro again. The `ThisWorkbook.LinkSources(Type:=xlLinkTypeExcelLinks)` property will now correctly preserve and detect the connections.

Add Explicit Worksheet References
Verify Link Sources: After applying this workaround, check the Data tab > Edit Links to ensure all external workbooks are properly listed and their status shows as updating.
Free Microsoft Office alternative

Try WPS Office for Reliable Spreadsheet Management

If you frequently encounter frustrating bugs with macros, phantom links, or Name Manager issues in Microsoft Excel, consider switching to WPS Office. It is a powerful, lightweight, and completely free alternative that seamlessly handles complex spreadsheet tasks.

Fully compatible with Microsoft Excel file formats (.xlsx, .xls, .xlsm).Reliable management of defined names and cross-workbook data links without phantom link bugs.Familiar user interface with a built-in Name Manager and advanced formula support.Lightweight installation that runs smoothly on Windows, Mac, and Linux environments.
microsoft office alternative - wps office

Frequently Asked Questions

Why do external links disappear from the LinkSources collection?

In some versions of Excel, if external links are only referenced inside the Name Manager (defined names) and not physically on a worksheet, Excel's VBA LinkSources method may fail to detect them after a macro updates or calculates the workbook.

How can I view all external links in my workbook?

Go to the Data tab on the Excel ribbon and click 'Edit Links' in the Queries & Connections group. This dialog box displays all active external workbook references and allows you to update or break them.

What are phantom links in Excel?

Phantom links are external references that no longer exist in formulas or active defined names but are still cached by Excel's hidden objects, charts, or corrupted Name Manager entries. They often trigger unwanted 'Update Links' prompts when opening the file.

Can I hide the explicit worksheet references used in the workaround?

Yes. You can place all your explicit external references on a single worksheet, right-click the worksheet tab at the bottom, and select 'Hide'. Excel will still read the references and preserve the external links without cluttering your main workspace.