Forum Discussion
Save and close large files
Based on what you described (Windows 11, OneDrive for Business, large Excel/Word files, VBA macros).
What’s happening is basically a race condition between:
- Office telling OneDrive "file is saved, sync it"
- You (or VBA) telling Office "close the file immediately"
When the save and close come back-to-back, OneDrive/Office Upload Center sometimes doesn’t have time to update the cached copy before the file handle closes. That’s why you see “server version has been edited” or “please re-save” errors, especially on larger files.
Manual habit (what you’ve already discovered)
- Do Ctrl+S (Save), wait a couple of seconds until the OneDrive icon shows a small green check, then close.
- Annoying, but works.
VBA workaround (best option for automation)
Here’s a drop-in VBA procedure you can add to any Excel file (or your Personal Macro Workbook), and then call it instead of ThisWorkbook.Close or ActiveWorkbook.Close.
' ================================
' Safe Save-and-Close for OneDrive
' ================================
' Call SafeClose ThisWorkbook
' or SafeClose Workbooks("MyFile.xlsx")
' instead of .Close
Public Sub SafeClose(wb As Workbook, Optional DelaySeconds As Double = 2)
On Error GoTo ErrHandler
' 1. Save explicitly
wb.Save
' 2. Give OneDrive/Office Upload Cache time to catch up
If DelaySeconds > 0 Then
Application.Wait (Now + TimeSerial(0, 0, DelaySeconds))
End If
' 3. Close without asking again (already saved above)
wb.Close SaveChanges:=False
Exit Sub
ErrHandler:
MsgBox "Error closing workbook '" & wb.Name & "': " & Err.Description, vbExclamation
End Sub
Anywhere you would normally write:
ThisWorkbook.Close SaveChanges:=True
This way, the explicit Save happens, OneDrive has ~2 seconds to register it, and then the workbook closes without prompting.
You can adjust the delay if needed (2–5 seconds for large files).
Disable "Use Office applications to sync Office files"
- In OneDrive settings → Office tab → uncheck "Use Office applications to sync Office files I open".
- This makes OneDrive do the syncing instead of relying on the Office Upload Cache.
- Many users report it fixes weird save/close sync issues (but you lose some coauthoring features).
My answers are voluntary and without guarantee!
Hope this will help you.
Was the answer useful? Mark as best response and like it!
This will help all forum participants.