Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK 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
Nov 16, 2023
9
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?
 
Replies continue below

Recommended for you

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