none
Is it posible to create a vba/macro using Open Xml Format and open xlsm files

    Question

  • Hi,

    We're trying to use the Open Xml Format Library for generating excel documents. So we would like some infomation and specifications about Open Xml Format.

    What we want to do, is to write the vba Macro statically from c#, and then add them to an excel document without using interop.

    And a second thing we are wondering about is, whether it is even posible to open a .xlsm in Open Xml Format?

    Hope you can help with these questions.

    Best Regards

    Joakim

    jeudi 31 mars 2016 14:39

Réponses

  • >>>What we want to do, is to write the vba Macro statically from c#, and then add them to an excel document without using interop.

    This is not a simple task. So I suggest that you could refer to this helpful link:

    http://openxmldeveloper.org/discussions/development_tools/f/35/p/5911/159978.aspx

    >>>And a second thing we are wondering about is, whether it is even posible to open a .xlsm in Open Xml Format?

    If I have not any misunderstandings on your question, there is nothing to prevent you from writing data into XLSM with Open Xml.  It works fine. 

    using DocumentFormat.OpenXml;
    using DocumentFormat.OpenXml.Packaging;
    using DocumentFormat.OpenXml.Spreadsheet;
    
    // Open the document for editing.
    using (SpreadsheetDocument spreadsheetDocument =
        SpreadsheetDocument.Open(yourXlsmfile, false))
    {
        
    }


    For more information, click here to refer about How to: Parse and read a large spreadsheet document (Open XML SDK)

    Disclaimer: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    vendredi 1 avril 2016 04:58

Toutes les réponses

  • >>>What we want to do, is to write the vba Macro statically from c#, and then add them to an excel document without using interop.

    This is not a simple task. So I suggest that you could refer to this helpful link:

    http://openxmldeveloper.org/discussions/development_tools/f/35/p/5911/159978.aspx

    >>>And a second thing we are wondering about is, whether it is even posible to open a .xlsm in Open Xml Format?

    If I have not any misunderstandings on your question, there is nothing to prevent you from writing data into XLSM with Open Xml.  It works fine. 

    using DocumentFormat.OpenXml;
    using DocumentFormat.OpenXml.Packaging;
    using DocumentFormat.OpenXml.Spreadsheet;
    
    // Open the document for editing.
    using (SpreadsheetDocument spreadsheetDocument =
        SpreadsheetDocument.Open(yourXlsmfile, false))
    {
        
    }


    For more information, click here to refer about How to: Parse and read a large spreadsheet document (Open XML SDK)

    Disclaimer: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    vendredi 1 avril 2016 04:58
  • If you have VBA macros you can implement them through OpenXml library to the files. 
    If you describe me the situation, what exactly you have now and want to have at the end then I can help you with this. 

    Best Regards
    mercredi 16 mai 2018 11:52