How to find and remove active content links in excel

%3CLINGO-SUB%20id%3D%22lingo-sub-2796794%22%20slang%3D%22en-US%22%3EHow%20to%20find%20and%20remove%20active%20content%20links%20in%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2796794%22%20slang%3D%22en-US%22%3E%3CP%3EWhen%20I%20open%20my%20excel%20file%20(using%20Office%20365)%20I%20get%20this%20security%20message%3A%3C%2FP%3E%3CP%3ESECURITY%20WARNING%3A%20Some%20active%20content%20has%20been%20disabled.%20Click%20for%20more%20details.%26nbsp%3B%20%5BEnable%20Content%5D%3C%2FP%3E%3CP%3EWhen%20I%20click%20%5BEnable%20Content%5D%2C%20excel%20proceeds%20to%20try%20and%20access%20files%201)%20linked%20files%20available%20on%20my%20network%20but%20have%20been%20moved%20and%202)%20MS%20365%20login%20dialog%20box%20opens%20and%20requests%3A%20Sign%20In.%26nbsp%3B%20Tell%20us%20the%20account%20you%20want%20to%20use%20to%20open%20%5BCharts%5D%20-%20random%20name%20of%20file%20to%20illustrate%20my%20problem.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20my%20problem%20is%20%232%20above%3A%20how%20do%20I%20find%20where%20%5BCharts%5D%20and%20remove%20the%20%5BCharts%5D%20link%20is%20because%20its%20not%20in%20Data%20%26gt%3B%20Edit%20Links%2C%20Data%20%26gt%3B%20Queries%20%26amp%3B%20Connections%2C%20Formulas%20%26gt%3B%20Name%20Manager%2C%20Control%20G%20%26gt%3B%20Object%20search%2C%20Control%20F%20search%20for%20%5BCharts%5D%20across%20the%20workbook%3B%20and%20its%20not%20an%20external%20link%20in%20a%20chart%2C%20pivot%20table%2C%20or%20macro.%26nbsp%3B%20With%20regards%20to%20the%20File%20%26gt%3B%20Options%20%26gt%3B%20Trust%20Centre%20%26gt%3B%20Active%20X%20Settings%2C%20I%20can%20change%20the%20Active%20X%20settings%20to%20%22disable%20all%20control%20without%20notification%22%20but%20that%20does%20not%20solve%20my%20problem%20of%20finding%20and%20removing%20the%20%5BCharts%7D%20link.%26nbsp%3B%20Also%20the%20Data%20%26gt%3B%20Edit%20Links%20%26gt%3B%20Startup%20Prompt%20does%20not%20apply%20because%20%5BCharts%5D%20does%20not%20appear%20as%20a%20link.%26nbsp%3B%20My%20file%20has%20some%20minor%20macros%20but%20I%20have%20gone%20through%20every%20line%20of%20the%20code%20and%20it%20does%20not%20have%20links%20or%20references%20to%20%5BCharts%5D.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20followed%20most%20of%20the%20steps%20on%20this%20page.%26nbsp%3B%20I%20stopped%20at%20Dynamic%20Arrays%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.ablebits.com%2Foffice-addins-blog%2F2021%2F01%2F27%2Ffind-break-external-links-excel%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EHow%20to%20find%20links%20in%20Excel%20and%20break%20external%20links%20-%20Ablebits.com%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20all%20started%20because%20I%20was%20copying%20data%20or%20importing%20tabs%20from%20other%20excel%20spreadsheets%20into%20my%20spreadsheet.%26nbsp%3B%20So%20I%20am%20now%20trying%20to%20clean%20up%20my%20file%20to%20get%20rid%20of%20these%20hidden%20Active%20Content%20links%3C%2FP%3E%3CP%3ESo%20back%20to%20my%20original%20question%3A%20how%20do%20I%20find%20and%20remove%20Active%20Content%20links%20given%20all%20of%20the%20steps%20I%20have%20take%20above%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2796794%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2796846%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20find%20and%20remove%20active%20content%20links%20in%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2796846%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1170489%22%20target%3D%22_blank%22%3E%40Hello380%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-visual-basic%22%3E%3CCODE%3ESub%20BreakLinks()%0A%20%20%20%20Dim%20wb%20As%20Workbook%0A%20%20%20%20Set%20wb%20%3D%20Application.ActiveWorkbook%0A%20%20%20%20If%20Not%20IsEmpty(wb.LinkSources(xlExcelLinks))%20Then%0A%20%20%20%20%20%20%20%20For%20Each%20link%20In%20wb.LinkSources(xlExcelLinks)%0A%20%20%20%20%20%20%20%20%20%20%20%20wb.BreakLink%20link%2C%20xlLinkTypeExcelLinks%0A%20%20%20%20%20%20%20%20Next%20link%0A%20%20%20%20End%20If%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2797044%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20find%20and%20remove%20active%20content%20links%20in%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2797044%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F767933%22%20target%3D%22_blank%22%3E%40Juliano-Petrukio%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20reply%20but%20that%20unfortunately%20is%20overkill%20as%20it%20breaks%20all%20links.%20I%20need%20to%20selectively%20find%20the%20Active%20Control%20%5BCharts%5D%20link%2C%20review%20that%20its%20not%20critical%2C%20then%20break%20it%20if%20I%20deem%20it%20to%20be%20useless.%20I%20have%20whole%20bunch%20of%20other%20links%20%5BData%20%26gt%3B%20Edit%20Links%5D%20in%20the%20file%20that%20are%20valid%20and%20must%20remain%20intact.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2800864%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20find%20and%20remove%20active%20content%20links%20in%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2800864%22%20slang%3D%22en-US%22%3E%3CP%3EA%20colleague%20thought%20there%20might%20some%20hidden%20names%20and%20sent%20me%20over%20a%20VBA%20script%20to%20unhide%20names.%20After%20running%20the%20macro%2C%20I%20deleted%20hundreds%20of%20broken%2C%20unused%20names%20that%20were%20originally%20hidden.%20Unfortunately%2C%20it%20only%20solved%20a%201%2F3%20of%20the%20spreadsheet's%20Active%20Content%20links%20so%20I%20am%20still%20looking%20other%20ideas%20on%20where%20they%20might%20be%20hidden.%3CBR%20%2F%3E%3CBR%20%2F%3ESub%20ShowAllNames()%3CBR%20%2F%3EDim%20n%20As%20Name%3CBR%20%2F%3EFor%20Each%20n%20In%20ActiveWorkbook.Names%3CBR%20%2F%3En.Visible%20%3D%20True%3CBR%20%2F%3ENext%20n%3CBR%20%2F%3EEnd%20Sub%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

When I open my excel file (using Office 365) I get this security message:

SECURITY WARNING: Some active content has been disabled. Click for more details.  [Enable Content]

When I click [Enable Content], excel proceeds to try and access files 1) linked files available on my network but have been moved and 2) MS 365 login dialog box opens and requests: Sign In.  Tell us the account you want to use to open [Charts] - random name of file to illustrate my problem.

 

So my problem is #2 above: how do I find where [Charts] and remove the [Charts] link is because its not in Data > Edit Links, Data > Queries & Connections, Formulas > Name Manager, Control G > Object search, Control F search for [Charts] across the workbook; and its not an external link in a chart, pivot table, or macro.  With regards to the File > Options > Trust Centre > Active X Settings, I can change the Active X settings to "disable all control without notification" but that does not solve my problem of finding and removing the [Charts} link.  Also the Data > Edit Links > Startup Prompt does not apply because [Charts] does not appear as a link.  My file has some minor macros but I have gone through every line of the code and it does not have links or references to [Charts].

 

I have followed most of the steps on this page.  I stopped at Dynamic Arrays

How to find links in Excel and break external links - Ablebits.com

 

This all started because I was copying data or importing tabs from other excel spreadsheets into my spreadsheet.  So I am now trying to clean up my file to get rid of these hidden Active Content links

So back to my original question: how do I find and remove Active Content links given all of the steps I have take above?

 

EDIT: I have existing links in the file that must remain intact.  The links identified in Data > Edit Links are all valid.  

5 Replies

@Hello380 

Sub BreakLinks()
    Dim wb As Workbook
    Set wb = Application.ActiveWorkbook
    If Not IsEmpty(wb.LinkSources(xlExcelLinks)) Then
        For Each link In wb.LinkSources(xlExcelLinks)
            wb.BreakLink link, xlLinkTypeExcelLinks
        Next link
    End If
End Sub

@Juliano-Petrukio 

 

Thank you for your reply but that unfortunately is overkill as it breaks all links. I need to selectively find the Active Control [Charts] link, review that its not critical, then break it if I deem it to be useless. I have whole bunch of other links [Data > Edit Links] in the file that are valid and must remain intact.

A colleague thought there might some hidden names and sent me over a VBA script to unhide names. After running the macro, I deleted hundreds of broken, unused names that were originally hidden. Unfortunately, it only solved a 1/3 of the spreadsheet's Active Content links so I am still looking other ideas on where they might be hidden.

Sub ShowAllNames()
Dim n As Name
For Each n In ActiveWorkbook.Names
n.Visible = True
Next n
End Sub

Just a final follow-up note for anyone that comes searching for a solution to find and break hidden excel links based upon my research:

0. Depending on the level of severity of the number of hidden links in your file, I wouldn't "Enable All Macros" unless you were at wits end. In my situation, when I Enabled All Macros, it revealed several linked files that I was completely unaware of. There are other settings in the trust center that may be worth playing with including ActiveX Settings for All Office Applications
https://webhelp.cloud.taxsystems.com/alphabridge/download_template/How_to_enable_Trust_Center_macro_...

1. Follow the steps in this link (including the VBA steps)
https://www.ablebits.com/office-addins-blog/2021/01/27/find-break-external-links-excel/

2. Next run the ShowAllNames VBA script from the comment above

To paste a list of defined names to a location in the current workbook, do the following:
Select the cell for the paste target
On the ribbon use the sequence Formulas > Defined Names > Use in Formula > Paste Names (the last item), or simply press the F3 short cut
In the Paste Names dialog box, click the Paste List item. The list is now the selection

3. Running Manville's findlink excel utility is useful but it does not get 100% of the hidden links. It's the combination of all these steps that cleans up most of the hidden links. In addition, run the following searches (wildcards are accepted): .xl*, #REF, #N/A - the searches did find some interesting things in my case
https://manville.org.uk/software/findlink.htm

4. As a last step, use Juliano-Petrukio BreakLinks VBA script in the first comment. This script should be used as a last resort if you cannot find any of the remaining links as it does not show you where the remaining links are hiding.  

Other useful website links:
https://wmfexcel.com/2018/04/12/hide-and-seek-external-links-in-excel/
https://marqueegroup.ca/resource/removing-phantom-links/