VBA: Refreshing a shared workbook from internet

TomCon

Active Member
Joined
Mar 31, 2011
Messages
385
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I have a workbook on OneDrive that is shared. The workbook is open both on my PC and on my Android phone and i update it from both places.

When i'm on my PC, i hit the Save button and that updates any changes from the Android copy...but it takes a few seconds. There is some latency.

Eventually i run a macro (on the PC side) to process the data in a certain way. The first thing i do in the macro is Save, in attempt to update the Windows version with any changes from the Android side, like this:
Windows("D4p-Enter.xlsx").Activate
ActiveWorkbook.Save

But, it appears to me that the update is actually not finished upon completion of executing the ActiveWorkbook.Save line (I am guessing presumably due to latency in update), but the macro code moves forward right after the save line to the next code line, and so now the macro does not process the data (from the Android copy) that i need to be there before the macro continues.

Is there a "smart" way to have my macro pause until any new data that may have been in the Android side is updated into the workbook, and at that time code could continue to execute? I suppose i could have it pause for a set number of seconds, but that would be a bit unreliable.

Thanks!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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