Search code examples
vbaexcel

How to find location of link in Excel workbook?


I have an Excel book that, when opened, gives the warning:

This workbook contains links to other data sources.

I want to remove all of these links so that the warning will not be triggered. Thinking that any external link will be of the form '[workbook path]'!address I used this code:

Sub ListLinks()
Dim wb As Workbook
Dim link As Variant
Set wb = ThisWorkbook
For Each link In wb.LinkSources(xlExcelLinks)
    Debug.Print link
Next link

End Sub

This returned a file path:

\\somePath\xyz\aWorkbook.xlsm

I searched all formulas in the workbook for this string using Ctrl+F, but no results were returned. How do I find and remove this link?


Solution

  • Breaking the links is not enough to suppress the warning. On the Edit Links window, I clicked Startup Prompt and set the radio button to "Don't display the alert and don't update automatic links". This successfully prevented the warning from appearing.