VBA: Remove update links in source data.

MrActuary

Board Regular
Joined
Jun 18, 2004
Messages
73
I have a macro that reads in an array of Excel files then processes each file before moving onto the next with the following code to select the array and open it:

Pth = Application.GetOpenFilename("excel files, *.xls", MultiSelect:=True)

For i = LBound(Pth) To UBound(Pth)
On Error Resume Next
If Pth <> "False" Then Workbooks.Open Pth(i)

Acct = ActiveWorkbook.Name


The problem is that many of the files contained in the Pth(i) array have links to external data sources which pauses the macro with the pop-up "update links" message. Is it possible to insert code that will tell the macro to automatically NOT update links in these external files? I know that Application.DisplayAlerts = False does this, but this seems to only work for the workbook running the macro and not these external files being read in. Any help is appreciated.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Try this

If Pth <> "False" Then Workbooks.Open Pth(i), UpdateLinks:=False

Hope that helps...
 
Upvote 0

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
No problem...

I'm not sure though, you may need to reset that to TRUE before Saving/Closing that file...

workbooks("x.xls").UpdateLinks = xlUpdateLinksAlways
 
Upvote 0

Forum statistics

Threads
1,191,280
Messages
5,985,731
Members
439,978
Latest member
Mr930R

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
Top