Is there a way to open a workbook, refresh everything and close after success.

Saud_Jilani

New Member
Joined
Mar 30, 2024
Messages
7
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I have 2 files, first one is the Master Inventory and second one is the Partial Inventory. Basically, the second file is a subset of the main file and has a data model relation. I need a way to refresh it periodically (for instance daily). But I need to open the file and click refresh all for that. How can I automate it? Both files are stored on OneDrive.

I have been trying to achieve this for a while, but couldn't. I used VBA, PowerAutomate and even Office scripts. Read multiple articles to achieve this via VBA, but no success. All I get is the workbook gets opened and close without the update. The part of the VBA script to open it and Refresh works, but as soon as I add the Close file command - it doesn't save the updates.

Office Script works and would do it at set time but doesn't refresh external connections as it is not supported in Office Web (whereas interestingly, the trigger to start automatically is only supported by Office Online).

Ideally, it would be best to achieve this on cloud.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hello. Some questions:
1. Is background refresh enabled for the query?
2. Are you saving the workbook before closing?
3. Are you using the SaveChanges argument to Workbook.Close?
 
Upvote 0

Forum statistics

Threads
1,223,880
Messages
6,175,155
Members
452,615
Latest member
bogeys2birdies

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