Exception fired 0x800A03EC; Autosave the reason? Or something else?

Add-in Express™ Support Service
That's what is more important than anything else

Exception fired 0x800A03EC; Autosave the reason? Or something else?
Can Autosave fired the save be "checked" in WorkbookBeforeSave?  
Subscribe
Norman Neubert




Posts: 15
Joined: 2022-06-09
Hi, I use this function to execute code in before save for a file on sharepoint:

Private Sub AdxExcelAppEvents1_WorkbookBeforeSave(sender As Object, e As ADXHostBeforeSaveEventArgs) Handles AdxExcelAppEvents1.WorkbookBeforeSave

In fact my plugin saves the file in this function (AdxExcelAppEvents1_WorkbookBeforeSave) and sets cancel to true afterwards. It of course also sets saved = true.

This is how I save, nothing special to it: wb.SaveAs(wb.FullName, Local:=True)

This I how i get control before and after the save process. Especially after is important for what I am doing.

In seldom cases this fires an exception:

Microsoft.Office.Interop.Excel._Workbook.SaveAs(Filename as object, FileFormat....)
System.Runtime.InteropServices.COMException
Exception from HRESULT: 0x800A03EC

As said most of the time it works.

2 Questions:

- Any idea why the exception fires?

- Could it be that the autosave produces the problem? If yes, is there a way to find out if the autosave was started by autosave or manually by the user?

Thanks in advance
Norman
Posted 04 Nov, 2024 16:32:33 Top
Andrei Smolin


Add-in Express team


Posts: 19011
Joined: 2006-05-11
Hello Norman,

I have an impression that 0x800A03EC occurring on workbooks or sheets relates to the workbooks or sheets being in windows that aren't active.

I believe your issue is caused by AutoSave.

At https://learn.microsoft.com/en-us/office/vba/library-reference/concepts/how-autosave-impacts-addins-and-macros, they suggest that you have wb.AutoSaveOn set to false; see Issue 5: Code in BeforeSave cancels the file save (by setting Cancel argument to True)

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 05 Nov, 2024 09:09:58 Top
Norman Neubert




Posts: 15
Joined: 2022-06-09
Thank you Andrei, this is very helpful. I am not sure if the users will accept the solution but now we do know where the exception probably comes from. Thanks! :)

Kind regards, Norman
Posted 06 Nov, 2024 06:52:53 Top
Andrei Smolin


Add-in Express team


Posts: 19011
Joined: 2006-05-11
Welcome!

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 06 Nov, 2024 08:43:35 Top