I create a report by moving data from fox into an excel template via automation. I then invoke macros in the template to copy the data over and do a bunch of formatting. I would like to drop the macro from the template before I save the file for distribution. That way I can avoid the pesky nag screen that appears when you open an excel file with a macro in it ... makes my boss uncomfortable. :)
Problem is I am not sure exactly how to do that. Here is a simplified version of what I am doing:
local tcXLSAPP
* Open excel
tcXLSAPP = createobject("Excel.Application")
tcXLSAPP.visible = .t.
tcXLSAPP.workbooks.open("MyTemplate.xls") && Excel template
* Insert data and Format report
wait window "Moving data to Excel from file " + m.tcFileName nowait
tcXLSAPP.worksheets.item("Paste Data").select
tcXLSAPP.run( "InsertWorksheet", "SourceData.xls" ) && Macro:Data to template
tcXLSAPP.run( "FormatData" ) && Format data macro
* do something here to drop the macros
*Save report
tcXLSAPP.ActiveWorkbook.saveas("MyReport.xls")
* Close Excel
tcXLSAPP.quit
tcXLSAPP = .null.
release m.tcXLSAPP
Thanks in advance!
Carole Shaw
Fred Hutchinson Cancer Research Center
Eagles may soar, but weasels don't get sucked into jet engines.