A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi @Akbar Husain,
In this scenario, the 0x800A03EC error is typically raised by Excel itself declining the save operation, rather than an issue within the VB.NET code.
Since .xls and .xlt are legacy binary formats, many Microsoft 365 environments apply security restrictions through GPO, Intune, or Cloud Policy that prevent saving files in Excel 97–2003 formats. When these restrictions are in place, Excel Interop often reports only the generic error HRESULT: 0x800A03EC, without additional detail.
To help narrow this down, you may want to review the following:
- In Excel > Options > Trust Center > File Block Settings, confirm that the Save checkbox (not just Open) is unchecked for "Excel 97–2003 workbooks and templates".
- If your organization manages these settings centrally, be aware that policy enforcement can override any local Trust Center changes.
- If you are saving an .xlt file, ensure the correct format is used:
Use XlFileFormat.xlTemplate8 for templates
Use XlFileFormat.xlExcel8 for workbooks (.xls)
As a simple validation step, you can try saving the file as .xlsx first. If that succeeds, it usually confirms that the automation itself is working correctly and that the issue is specific to legacy formats being blocked by policy.
For reference, you may find the following documentation helpful:
- Error message in Office when a file is blocked by registry policy settings
- Microsoft 365 Apps for Enterprise security baseline settings reference for Microsoft Intune
- XlFileFormat enumeration (Excel)
For a cleaner VB.NET approach, you could use something like the following:
Dim ext = IO.Path.GetExtension(pstrDestFileName).ToLowerInvariant()
Dim fmt As Excel.XlFileFormat =
If(ext = ".xlt", Excel.XlFileFormat.xlTemplate8,
Excel.XlFileFormat.xlExcel8) ' .xls
wb.SaveAs(pstrDestFileName, fmt)
While this will not bypass any organizational policies, it does ensure the correct format is applied and avoids potential mismatches when saving .xlt files.
I hope these suggestions help move things in the right direction. Please let me know your results. If the issue persists, it would also be useful to know whether this is a work or school–managed device (Intune/GPO/security baseline) or a personal, unmanaged Microsoft 365 installation, as that distinction can affect the behavior significantly.
If you have any questions or need further assistance, please feel free to reach out. I’m happy to continue helping and look forward to your update.
If the answer is helpful, click on "Accept Answer" and please vote positively. If you have additional questions about this answer, click on "Comment".
Note: Follow the steps in our documentation to enable email notifications if you want to receive the email notification related to this thread.