Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run an xls macro and apply it on a particular xls file 1

Status
Not open for further replies.

torturedmind

Programmer
Jan 31, 2002
1,052
PH
[tt]Hi all. I just wanted to ask something about Excel automation. How can I run a macro recorded in MSExcel 2000 and apply that macro to an xls file exported from vfp6? I also need to run the macro from within vfp6.

Thanks in advanced.[/tt]

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
Hi Kilroy,

To run a macro programmatically from within VFP:

Code:
loExcel = CREATEOBJECT("Excel.Application")
...
...
loExcel.Run("MyMacro")

You might need to qualify the macro name with the name of the workbook (e.g. "MyWorkBook!MyMacro").

I'm not sure what you mean about applying the macro to a file exported from VFP. You can apply a macro to any workbook. It doesn't care whether the file came from VFP or anywhere else.

Mike




__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Thanks Mike for the very quick response. Am gonna try it later.

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top