Help with Someone else is.... error while saving

ipon70

Board Regular
Joined
May 8, 2013
Messages
86
Office Version
  1. 2016
Platform
  1. Windows
I have an error which is getting annoying.
Here is the code that is running on the laptop, the first code is on the main sheet, the last 3 are modules.
I get an error randomly that says something to the effect "someone else is working in...". There is no one else working on this file, just this laptop has it open, or really even has access. The only other thing touching it is PowerBi to pull the data from Columns G-K, once every 2 minutes.
I would love to setup some sort of error handler that would just get rid of the error, and try again a little later. Is that possible??

Thanks again for any help, you guys are always so knowledgable.



Sub LoopForever()
For i = 0 To 5000000
Application.Wait (Now + TimeValue("00:03:00"))
Call UpDown
Call Refresh
Call SaveMe
Next i
End Sub

-----------------------------
Sub UpDown()
Worksheets("wait").Range("I2:I6").Copy
Worksheets("wait").Range("j2:j6").PasteSpecial Paste:=xlPasteValues
End Sub
--------------------------------------
Sub Refresh()
ThisWorkbook.RefreshAll
End Sub
------------------------------------
Sub SaveMe()
ThisWorkbook.Save
End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
My first suspect would be that the .Save process can't start unless the .RefreshAll process has finished and they are sometimes colliding. I don't know how you could catch that with an error handler. You can try this approach for the RefreshAll: How to wait until ActiveWorkbook.RefreshAll finishes before executing more code

If you want to try error handlers, this might do something:
VBA Code:
Sub SaveMe()
    On Error GoTo SaveFailed
    ThisWorkbook.Save
    Exit Sub
SaveFailed:
    'handle error here, maybe set a value in a sheet?
End Sub
 
Upvote 0
My first suspect would be that the .Save process can't start unless the .RefreshAll process has finished and they are sometimes colliding. I don't know how you could catch that with an error handler. You can try this approach for the RefreshAll: How to wait until ActiveWorkbook.RefreshAll finishes before executing more code

If you want to try error handlers, this might do something:
VBA Code:
Sub SaveMe()
    On Error GoTo SaveFailed
    ThisWorkbook.Save
    Exit Sub
SaveFailed:
    'handle error here, maybe set a value in a sheet?
End Sub
Ok thanks. I have all but given up. I will try a simple wait command and see if that works
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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
Back
Top