Macro to open workbooks then update, then close

steallan

Active Member
Joined
Oct 20, 2004
Messages
308
Hi.

Hope someone can help me with the following small problem. We've got a workbook, links to three other workbooks, but the data wont refresh through the links. When we open the three workbooks manually, then hit refrest all, the data does update.

My friend has had a good search for a solution, can find others with the same problem but cant find any fix that works. I bet MrExcel would crush it. Wondering if someone has a macro that would open the three books, run refresh all, then shut the three books.

Any help would be much appreciated.

Thanks

Stephen
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Try something like this:

Sub update1A()
Application.ScreenUpdating = False
Workbooks.Open "C:\Documents\workbookname.xlsm"
With ActiveWorkbook
.RefreshAll
.Save
.Close
End With
Workbooks.Open "C:\U\Documents\nextworkbookname.xlsm"
With ActiveWorkbook
.RefreshAll
.Save
.Close
End With
Workbooks.Open "C:\Documents\finalworkbookname.xlsm"
With ActiveWorkbook
.RefreshAll
.Save
.Close
End With
Application.ScreenUpdating = True
End Sub

<strike></strike>
 
Upvote 0
Thanks very much, that looks great. We had a piece of code similar but missing some bits, yours looks the business.

I talk strange online.

Thanks TG
 
Upvote 0
Thanks for the reply and I hope it works for you.
 
Upvote 0

Forum statistics

Threads
1,223,710
Messages
6,174,017
Members
452,542
Latest member
Bricklin

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