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 the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
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,224,749
Messages
6,180,725
Members
452,995
Latest member
isldboy

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