Skip to main content
added 93 characters in body
Source Link

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

This issue occurs only in MS Office 365 Version. In Excel 2024 it is working as intended.

The error occurs on the following line of code:

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

Code

VB.net

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?

Please go through the link and all the comments before replying, as this is the same issue I posted on Microsoft Q&A. Reviewing the complete discussion will help in understanding the exact issue and troubleshooting it in the right direction, which can help avoid multiple back-and-forth loops.

https://learn.microsoft.com/en-us/answers/questions/5883264/unable-to-save-saveas-xls-and-xlt-files-using-micr?page=1&orderby=Helpful&comment=answer-12761256&translated=false#newest-answer-comment

Thanks,

Akbar Husain.

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

VB.net

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?

Please go through the link and all the comments before replying, as this is the same issue I posted on Microsoft Q&A. Reviewing the complete discussion will help in understanding the exact issue and troubleshooting it in the right direction, which can help avoid multiple back-and-forth loops.

https://learn.microsoft.com/en-us/answers/questions/5883264/unable-to-save-saveas-xls-and-xlt-files-using-micr?page=1&orderby=Helpful&comment=answer-12761256&translated=false#newest-answer-comment

Thanks,

Akbar Husain.

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

This issue occurs only in MS Office 365 Version. In Excel 2024 it is working as intended.

The error occurs on the following line of code:

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

Code

VB.net

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?

Please go through the link and all the comments before replying, as this is the same issue I posted on Microsoft Q&A. Reviewing the complete discussion will help in understanding the exact issue and troubleshooting it in the right direction, which can help avoid multiple back-and-forth loops.

https://learn.microsoft.com/en-us/answers/questions/5883264/unable-to-save-saveas-xls-and-xlt-files-using-micr?page=1&orderby=Helpful&comment=answer-12761256&translated=false#newest-answer-comment

Thanks,

Akbar Husain.

added 200 characters in body
Source Link

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

VB.net

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?

Please go through the link and all the comments before replying, as this is the same issue I posted on Microsoft Q&A. Reviewing the complete discussion will help in understanding the exact issue and troubleshooting it in the right direction, which can help avoid multiple back-and-forth loops.

https://learn.microsoft.com/en-us/answers/questions/5883264/unable-to-save-saveas-xls-and-xlt-files-using-micr?page=1&orderby=Helpful&comment=answer-12761256&translated=false#newest-answer-comment

Thanks,

Akbar Husain.

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

VB.net

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?

Please go through the link and all the comments before replying, as this is the same issue I posted on Microsoft Q&A. Reviewing the complete discussion will help in understanding the exact issue and troubleshooting it in the right direction, which can help avoid multiple back-and-forth loops.

Thanks,

Akbar Husain.

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

VB.net

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?

Please go through the link and all the comments before replying, as this is the same issue I posted on Microsoft Q&A. Reviewing the complete discussion will help in understanding the exact issue and troubleshooting it in the right direction, which can help avoid multiple back-and-forth loops.

https://learn.microsoft.com/en-us/answers/questions/5883264/unable-to-save-saveas-xls-and-xlt-files-using-micr?page=1&orderby=Helpful&comment=answer-12761256&translated=false#newest-answer-comment

Thanks,

Akbar Husain.

Source Link

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

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

VB.net

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?

Please go through the link and all the comments before replying, as this is the same issue I posted on Microsoft Q&A. Reviewing the complete discussion will help in understanding the exact issue and troubleshooting it in the right direction, which can help avoid multiple back-and-forth loops.

Thanks,

Akbar Husain.