Excel Macro that Auto Updates Links/Refreshes

SeanCook

New Member
Joined
Dec 13, 2011
Messages
19
So i am trying to make a macro on a workbook(WB1). It has cells that link to other Workbooks (WB2-WB10). These (WB2-WB10) have two sheets that are linked to an access point which contains "1.xls" and "2.xls" (sheet1 linked to 1.xls, and sheet2 to 2.xls). I have tried a macro that will open the file, update links then save and close. Also tried the same but refreshall instead of update links, then again with a marco that does both, and yet everytime it runs, it goes through all the workbooks one by one, opens them, calculates, saves and closes, and yet when i go back to check, nothing is updated.

I have checked the access data and it is updated, and if i go into each workbook and manually click refresh it does indeed refresh. I am at a loss and dont know what i am doing wrong.

here is the code.


Sub GetFile()
Workbooks.Open "blahblah.xlsx", UpdateLinks:=1
ActiveWorkbook.RefreshAll
ActiveWorkbook.Close SaveChanges:=True

Any help would be greatly appreciated.

Thank You,

Sean
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,215,554
Messages
6,125,487
Members
449,233
Latest member
Deardevil

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