Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Macro File getting corrupted 1

Status
Not open for further replies.

pieswt

Mechanical
Joined
Nov 16, 2023
Messages
9
Location
IN
Hello all,

I have a excel file with some macros to process and export data to another excel file. Both the files are stored in one-drive (as multiple users need to work on it). The macro works fine for few times but after some time it starts giving this error:
MicrosoftTeams-image_vu4klz.png



When I click End and try to save the file it says the file is corrupted and needs to be repaired. After I repair the file and save it on local folder, it works fine without any error.

Can someone help me to avoid the error and the file doesn't get corrupted in shared folder?
 
You could be doing an operation that is faster than one-drive can sync files. From the error, it looks like the macro is trying to close excel before one-drive has finished. You could add in a delay before the quit command to see if it helps. If there is a one-drive object in vba to check its status so the macro knows it is safe to quit would be a better option.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top