Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Drop Excel Macro
Message
De
29/12/2003 18:32:15
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Drop Excel Macro
Divers
Thread ID:
00862694
Message ID:
00862694
Vues:
46
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform