Error opening saved .xlsm

Posted by: ljk on 8 August 2022, 7:53 am EST

    • Post Options:
    • Link

    Posted 8 August 2022, 7:53 am EST

    I receive an error trying to open a .xlsm file that was copied through fpSpread.

    Excel cannot open the file ‘2023-ExpendituresCopy.xlsm’ because the file format or file extension is not valid.

    
    Dim spr As New FarPoint.Win.Spread.FpSpread
    spr.OpenExcel("C:\TFS\Idaho\Code\SAS\bin\Debug\2023-Expenditures.xlsm", FarPoint.Excel.ExcelOpenFlags.DocumentCaching)
    spr.SaveExcel("C:\TFS\Idaho\Code\SAS\bin\Debug\2023-ExpendituresCopy.xlsm", FarPoint.Excel.ExcelSaveFlags.DocumentCaching)
    
    

    2023-Expenditures.zip

  • Posted 8 August 2022, 3:26 pm EST

    Hi,

    You are trying to save the file in an OpenXML format (“.xlsm”) but have not used the ExcelSaveFlags.UseOOXMLFormat flag in the SaveExcel method.

    Please try after modifying the code like the below:

    spr.SaveExcel("C:\TFS\Idaho\Code\SAS\bin\Debug\2023-ExpendituresCopy.xlsm", FarPoint.Excel.ExcelSaveFlags.UseOOXMLFormat Or FarPoint.Excel.ExcelSaveFlags.DocumentCaching)
    

    If you face any issues, let us know.

    Regards

    Avnish

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels