Share via

Unable to Save/SaveAs .xls and .xlt files using Microsoft.Office.Interop.Excel in VB.NET despite File Block Settings being unchecked in Trust Center

Akbar Husain 10 Reputation points
2026-05-07T07:14:53.38+00:00

I have a Windows Forms application developed in VB.NET. I am trying to open an Excel file, manipulate it by adding new sheets and data, and then save the file using Microsoft.Office.Interop.Excel.

All Excel file extensions are working as expected except .xls and .xlt. For these two extensions, the application throws the following error:

Error: Exception from HRESULT: 0x800A03EC

The error occurs on the following line of code:

wb.SaveAs(pstrDestFileName, Excel.XlFileFormat.xlExcel8)

Code

Sub Main()

    Dim xlApp As New Microsoft.Office.Interop.Excel.Application

    Dim wb As Microsoft.Office.Interop.Excel.Workbook

    Try

        xlApp = CreateObject("Excel.Application")

        xlApp.Interactive = False

        xlApp.DisplayAlerts = False

        xlApp.EnableEvents = False

        Dim pstrSrcFileName = "C:\Files\Book1.xls"

        Dim pstrDestFileName = "C:\Files\einfotree Copy of Book1.xls"

        wb = xlApp.Workbooks.Open(pstrSrcFileName, False, False, , "", "", , , , , , , False)

        wb.SaveAs(pstrDestFileName, Excel.XlFileFormat.xlExcel8)

        wb.Close(False)

        xlApp.Quit()

    Catch ex As Exception

       '

    End Try

End Sub

Note: Has there been any change in Microsoft Office versions or security settings that now restricts saving .xls or .xlt files using Interop?

Microsoft 365 and Office | Excel | For education | Windows
0 comments No comments

1 answer

Sort by: Most helpful
  1. Killian N 1,140 Reputation points Independent Advisor
    2026-05-07T08:41:50.17+00:00

    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".
      Screenshot of the Trust Center window.
    • 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:

    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.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.