Application breaks with "...contains links to other data sources" when code opens workbook. No links can be found.

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,562
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
With this code ....

Rich (BB code):
        Dim wba_name As Workbook
        Dim tCol As String
        
        wba_name = "WS " & format(ws_vh.Range("B17"), "dd-mmm-yy") & ".xlsx"
        If Dir(path_name & wba_name) <> "" Then '.tglb_wpl_crtt.BackColor = RGB(0,153,211)
            Workbooks.Open (path_name & wb_name)
            Set wb_name = Workbooks(wba_name)
     ...

When it reaches the line in red, Excel displays dialogue
"This workbook contains links to other data sources."

Question ... considering the code, would this be normal behaviour or is there an error with the code? Just wondering if I need to worry about it.
I've searched both documents for external links (Find links (external references) in a workbook - Excel) but nothing was found. I don't really know what links are being found to be updated.

If there is no need to be concerned, is there a way I can block this message from interfering with the flow of my application? Will displayalerts suspend this message?
 
Last edited:

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
try >
Application.DisplayAlerts = False

just after Dim tCol As String
 
Upvote 0
Thank you Mole for taking a moment to suggest a solution.

I applied your idea, but the dialogue is still appearing.

Rich (BB code):
Dim wb_name As Workbook
        Dim tCol As String
        
        Application.DisplayAlerts = False 
        
        ws_name = "WS " & format(ws_vh.Range("B17"), "dd-mmm-yy") & ".xlsx"
        If Dir(path_name & ws_name) <> "" Then '.tglb_wpl_crtt.BackColor = RGB(0,153,211)
            
            Workbooks.Open (path_name & ws_name)  ' <--- "This workbook contains links to other data sources."
            Set wb_name = Workbooks(ws_name)
 
Upvote 0
try
Code:
Workbooks.Open Filename:=path_name & ws_name, UpdateLinks:=False
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,412
Messages
6,119,365
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top