none
Adding a worksheet fails - only on .XLSM file RRS feed

  • Question

  • Hi all;

     am trying to add a worksheet to a workbook and it works fine for a .XLSX file. But for a .XLSM file - I get the dreaded COMException 0x800A03EC.

    I have tried all of the following and all fail:

    wrkbk.Worksheets.Add(Type.Missing, Type.Missing, Type.Missing, Type.Missing);

    wrkbk.Worksheets.Add(wrkbk.Worksheets[wrkbk.NativeWorkbook.Worksheets.Count], Type.Missing, Type.Missing, Type.Missing);

    wrkbk.Worksheets.Add(Type.Missing, wrkbk.Worksheets[wrkbk.NativeWorkbook.Worksheets.Count], Type.Missing, Type.Missing);



    Any ideas?

    thanks - dave



    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Sunday, June 3, 2018 1:18 PM

Answers

All replies

  • Hi Dave,

    I am failed to reproduce this issue. Could this issue be reproduced for all files with XLSM format? Or it is only relative to the specific document?

    I suggest that you try create a new blank spreadsheet with XLSM format and to check whether the issue could be reproduced. If you, repair or re-install should fix this issue. If it only relative to a specific document, you may remove the sensitive info and share it with us to help troubleshoot this issue.

    Regards & Fei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 4, 2018 7:41 AM
    Moderator

  • This is failing because the workbook is locked. A locked workbook cannot have worksheets added to it.

    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    • Marked as answer by DavidThi808 Wednesday, June 6, 2018 3:59 PM
    Wednesday, June 6, 2018 3:59 PM