Currently, the Excel assembly only has round-trip support for macros. You can submit a feature request for the ability to add or modify these macros here:https://www.infragistics.com/community/ideas
Round-trip support means if you load in a workbook which has VBA code, modify that workbook, and save it out again, that code will not be lost. However, you cannot change or add to that code. So I guess you could have a blank workbook with your code in it and load that workbook. Then call the overload of Export which takes a Workbook instance and pass in your loaded workbook. Then the exported workbook will have the code in it when you save it out.
Hello,
I tried the same. But when I save the workbook to the file system there is no macro in it.I am doing the things described one post above followed by one line of code more:
Dim theWorkBook As New Infragistics.Documents.Excel.Workbook Dim ExcelTemplate As String = Application.StartupPath & "\Export_Template.xlsm" theWorkBook.Load(ExcelTemplate)
ExcelExporter.Export(Grid, theWorkBook) theWorkBook.Save(Application.StartupPath & "\Test.xlsm")
I tried this by using the xlsm and the xls extension. In both cases there is no macro in it. But my template contains a macro.What is wrong?