Workbook.Save "Upload Failed" Due to Edit Locked File on SharePoint - Not Producing Error

jogett

New Member
Joined
Jun 7, 2017
Messages
3
Hi, I am trying to establish error handling for when a SharePoint-based network file won't save properly due to it being locked for editing by another user. When this happens, I simply want network users to get a message box indicating that the data wasn't saved. They can then request the individual using the file to close it or just not worry about the data updating. The problem I'm running into is VBA is not seeing the upload failure as an error, therefore not triggering the error sequence. If I run the Workbook.Save outside of error handling, the to-be-saved file has a yellow bar stating, "UPLOAD FAILED: This file is locked for editing by another user." This seems like an 'error' to me. Oddly enough, these circumstances create debug errors in other workbooks when the file is locked, but in this instance there is no debug.

This seems like a trivial issue, but I couldn't find ANYTHING online addressing this.

Thank you all for any help in advance!

This is a simplified version of the code:

Sub saveFile()

On Error GoTo Fail

Workbook.Save

Exit Sub

Fail:

MsgBox "Cannot update data. File is locked for editing by another user."

End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,143,692
Messages
5,720,313
Members
422,276
Latest member
streasure

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
Top