Saving in Shared mode

S

Stephen sjw_ost

I have an Excel spreadsheet that is being used in a SharedWorkbook state. I
have placed buttons on the tabs for my users to save the file instead of
using the save button on the Excel Menu Bar. I do this so the button can
update the time on the worksheet(s) to indicate what time the save occured.
The problem I am having is when 2 or more users try to save at the same
time, with or without using the button(s). The first user will be able to
save just fine but anyone else saving at that moment will get an error that
the file is locked and to try again later.

How can I make a loop that will detect if the file is busy and loop until
the file is available again, once available, perform the save?

Just off the top of my head, something like;

Do
If application locked "need help here" then
loop until application unlocked "need help here"
Else
Application.ActiveWorkBook.Save
End If

I hope this question makes sense.
Any help with this is greatly appreciated.
 
S

Stephen sjw_ost

I figured out my own answer.

Do
On Error Resume Next
ActiveWorkbook.Save
Loop until ActiveWorkbook.saved = True

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top