Run Macro with Excel Object ( from MS. Visual FoxPro 7.0 )

Run Macro with Excel Object ( from MS. Visual FoxPro 7.0 )

Post by VmlzdWFsIE » Fri, 29 Jul 2005 00:11:04


Hi,
I have a routine, that creates a Workbook, and a lot of tables to make
Graphs, but make graph with automation it's very afull, so i create a macro,
and i have de Macro.bas ( module ). I want to link this macro to every
workbook created with the routine, and launch (macro), but I'dont know how to
link or bind the macro to the new workbook , and after that , launch.
Regards, and good day

Helpme !!!!!!

XXXX@XXXXX.COM
 
 
 

Run Macro with Excel Object ( from MS. Visual FoxPro 7.0 )

Post by Cindy Wine » Fri, 29 Jul 2005 05:35:50

Hi Programmer,

You can add a macro to an Excel workbook with automation using

oExcel.ActiveWorkbook.VBProject.VBComponents("ThisWorkbook").CodeModule.AddFromFile("C:\MacroCode.txt")

You can run your macro using

oExcel.Application.Run("MyMacro")

--
Cindy Winegarden MCSD, Microsoft Visual Foxpro MVP
XXXX@XXXXX.COM www.cindywinegarden.com
Blog: http://www.yqcomputer.com/


"Visual FoxPro programmer"