Transfer macros to xlsm file

I've a user request to export our data plus the contents of template file (including all macros) to an .xlsm (macro enabled workbook) file.  Does anyone know if this is doable in flexcel,  and can someone give me an idea as to how I go about transferring the macros?  


BTW, I know how to export the data and the data of the template to an xlsx file as I'm already doing it,  but no idea how to transfer the macros,  and not sure if I need to do anything special to create the xlsm file.

TIA,
Keith

Hi,

In FlexCel we don't have a method to transfer macros from one file to another, but can't you just write  your macros in the template that you are using for exporting?  If you open an xlsm template, modify the data and save it as xlsm, it will preserve the macros.

Xlsx and Xlsm are actually slightly different inside, so you can't just rename an xlsx file to xlsm. If you don't explicitly pass a file format when saving, FlexCel  guesses automatically the format from the extension. So just saving as "file.xlsm" will save the file as xlsm, not xlsx. If saving to a stream, you need to explicitly say you want to save with the format xlsm, since when saving to streams there is no filename from where FlexCel could guess the file format.

ok,  thanks for the reply.  I'll try to figure a way to use a copy of the template,  but at the moment, the template files contain other information that isn't currently copied into the export file - I'll need to see if this can be removed.



Regards
Keith