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!

trouble running excel macro

Status
Not open for further replies.

glamb

Programmer
Dec 29, 2009
32
US
I am creating 3 workbooks, then adding data to just one workbook and formatting it. I have written an excel macro that does all this very nicely, but when I try to run it from the VFP 9 code, I get a message that the macro may not be available in this workbook or all macros may be disabled, except that I have set the macro security to enable all macros and I have checked the active workbook and can run the macro if I put set step on and do it manually.

This is the code:
oexcel.application.run("PERSONAL.XLSB.vfp2xls")
 
Rather than trying to run an Excel Macro with your Automation, you should use Automation to execute the same string of Excel (VBA) commands as are used within the Macro.

Yes, since the command language of an Excel Macro is VBA and you need to use VFP Automation syntax, there may be some parts that need converting, but they should be few.

Good Luck,
JRB-Bldr


 
I figured it out.
oExcel.APPLICATION.RUN("PERSONAL.XLSB!vfp2xls")
It was just a typo. And it actually is easier to run the macro from the VFP code. But thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top