none
Excel SDK version RRS feed

  • Question

  • Could a newer SDK than 12.0 fix an issue I have in exporting XLSM files to my folder from an app? It will export XLSX but corrupts any macros and hence does not save correctly.
    Wednesday, June 8, 2016 1:32 AM

Answers

  • Fellas,

       Thanks for the replies.  It was easier than this.  Excel does not install the VBA component unless it is a selected choice.  I had only installed the Excel component.  Thanks!!

    • Marked as answer by -tE Monday, July 11, 2016 2:19 AM
    Monday, July 11, 2016 2:19 AM

All replies

  • Hi te,

    >> Could a newer SDK than 12.0 fix an issue I have in exporting XLSM files to my folder from an app? It will export XLSX but corrupts any macros and hence does not save correctly.

    What is your app? Which code you used to export xlsm file? What do you mean with xlsm corrupt any macros? Did macro miss or it did not work?

    It would be helpful if you could share us more information.

    For a general suggestion, I suggest you create a workbook with macro manually, and then save it as xlsm file to check whether this issue is related with Excel application.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, June 9, 2016 6:49 AM
  • Hi te,

    >> Could a newer SDK than 12.0 fix an issue I have in exporting XLSM files to my folder from an app? It will export XLSX but corrupts any macros and hence does not save correctly.

    What is your app? Which code you used to export xlsm file? What do you mean with xlsm corrupt any macros? Did macro miss or it did not work?

    It would be helpful if you could share us more information.

    For a general suggestion, I suggest you create a workbook with macro manually, and then save it as xlsm file to check whether this issue is related with Excel application.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Hi Edward.  My .xlsx and .xlsm files are imported as resources.  The .xlsm has the macros embed within the .xlsm file.  The .xlsx file will copy to the public documents folder and then it is opened and written to(not macros data for the sheets).  The .xlsm file,  however,  seems to be having trouble being copied and saved for my app errors.  As well,  the file began the copy process.  But, when opening says the macros were corrupt and have been removed.  Win 7 this was not the case.


    • Edited by -tE Tuesday, June 14, 2016 6:11 AM
    Tuesday, June 14, 2016 6:07 AM
  • Hi te,

    How did you copy and save xlsm file? If you manually copy xlsm file, will it be corrupt? It would be helpful if you could share us your details code and steps to reproduce your issue.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, June 15, 2016 7:16 AM
  • You cannot export to an .xlsx file and assume that the macros are included. .xlsx files cannot contain macros but  .xlsm files can.

    This code works, exports current .xlsm file (adapt as needed).

    Option Explicit
    Sub ExportWithMacros()
        Dim Filename As String
       
        Filename = "ExportWithMacro.xlsm"
        ActiveWorkbook.SaveAs Filename
    End Sub


    Best regards, George


    Wednesday, June 15, 2016 7:58 AM
  • I agree with George. A file with the XLSM extension is an Excel Macro-Enabled Workbook file. For security reasons, XLS file or XLSX file does not enable macros by default. Thus, if you want to execute macros in Excel file, you need to convert XLS or XLSX to XLSM at the first place.

    Here is an solution of how to convert XLS or XLSX to XLSM:

    Private Shared Sub Main(args As String())
            Dim workbook As New Workbook()
            workbook.LoadFromFile("test.xls", ExcelVersion.Version97to2003)
            workbook.SaveToFile("result.xlsm", FileFormat.Version2007)
    End Sub

    Friday, June 17, 2016 3:47 AM
  • Fellas,

       Thanks for the replies.  It was easier than this.  Excel does not install the VBA component unless it is a selected choice.  I had only installed the Excel component.  Thanks!!

    • Marked as answer by -tE Monday, July 11, 2016 2:19 AM
    Monday, July 11, 2016 2:19 AM