drummer_jon
New Member
- Joined
- Oct 20, 2020
- Messages
- 1
- Office Version
- 365
- 2010
- Platform
- Windows
Hey MrExcel community! First up I have to express my thanks to the community at large for enabling me to develop a basic understanding of VBA over the years. This is my first post, because it's the first issue I've had which hasn't already been answered!
I have a fully automated large Excel file which once an hour pulls in data from different places and saves itself to make this data available to others. Most of the time it works flawlessly, but once in a while the line "thisworkbook.save" hard fails with a system dialog message such as this:
Now clearly the reason for the fail is evident, but what I don't understand is why the dialog box appears at all. Please can someone point me in the direction of better handling system dialog boxes like this one? I had thought that either ".displayalerts = false" or "on error resume next" would allow me to log this error without seeing a dialog box which requires user interaction. I'm using a desktop version of Excel 365 on Windows 10.
With a bit of fault finding I can recreate the issue using only the following code in a shiny new Excel file saved on a tiny Virtual Hard Drive that is almost full.
THINGS I'VE TRIED
- This behaviour happens on multiple machines that run the same version of Excel 365.
- However, in Excel 2010 this error message DOES NOT appear, and the error handler works as expected.
I have a fully automated large Excel file which once an hour pulls in data from different places and saves itself to make this data available to others. Most of the time it works flawlessly, but once in a while the line "thisworkbook.save" hard fails with a system dialog message such as this:
Now clearly the reason for the fail is evident, but what I don't understand is why the dialog box appears at all. Please can someone point me in the direction of better handling system dialog boxes like this one? I had thought that either ".displayalerts = false" or "on error resume next" would allow me to log this error without seeing a dialog box which requires user interaction. I'm using a desktop version of Excel 365 on Windows 10.
With a bit of fault finding I can recreate the issue using only the following code in a shiny new Excel file saved on a tiny Virtual Hard Drive that is almost full.
VBA Code:
Sub SaveFile()
On Error Resume Next
Application.DisplayAlerts = False
ThisWorkbook.Save
If Err.Number <> 0 Then
'<...code here which silently logs error and carries on back to the calling sub...>
End If
End Sub
THINGS I'VE TRIED
- This behaviour happens on multiple machines that run the same version of Excel 365.
- However, in Excel 2010 this error message DOES NOT appear, and the error handler works as expected.