[Migrated content. Thread originally posted on 27 August 2003]
Does anyone knows how to execute a VBA macro when using Excel OLE in AcuGT?
I have a worksheet
Book1.xls wich contains the macro
Macro1. With the Excel OLE sample program I found in this forum, I open this workbook and try to execute the macro with the following statement:
MODIFY hExcelApp @Run "Book1.xls!Macro1"But this doesn't work. What am I doing wrong?
I just found the solution for my problem:
MODIFY [B]hExcelWks[/B] @Application::Run "Book1.xls!Macro1"
[Migrated content. Thread originally posted on 27 August 2003]
Does anyone knows how to execute a VBA macro when using Excel OLE in AcuGT?
I have a worksheet
Book1.xls wich contains the macro
Macro1. With the Excel OLE sample program I found in this forum, I open this workbook and try to execute the macro with the following statement:
MODIFY hExcelApp @Run "Book1.xls!Macro1"But this doesn't work. What am I doing wrong?
To run a macro, you have to tell in which file the macro is. This file also has to be loaded. Like:
Assume MyMacro in file: MyMacros.xlm. To run it, you would first have to have the workbook load the MyMacros.xlm, then you would invoke the macro by:
MODIFY hExcel @Run("MyMacros.xlm!MyMacro")
If the macro returns something, remember GIVING
Finally, if parameters are required they are given like:
MODIFY hExcel @Run("MyMacros.xlm!MyMacro", p1, .., pn)
Note, Excel does not allow objects to be passed as parameters to the run method.
[Migrated content. Thread originally posted on 27 August 2003]
Does anyone knows how to execute a VBA macro when using Excel OLE in AcuGT?
I have a worksheet
Book1.xls wich contains the macro
Macro1. With the Excel OLE sample program I found in this forum, I open this workbook and try to execute the macro with the following statement:
MODIFY hExcelApp @Run "Book1.xls!Macro1"But this doesn't work. What am I doing wrong?
To run a macro, you have to tell in which file the macro is. This file also has to be loaded. Like:
Assume MyMacro in file: MyMacros.xlm. To run it, you would first have to have the workbook load the MyMacros.xlm, then you would invoke the macro by:
MODIFY hExcel @Run("MyMacros.xlm!MyMacro")
If the macro returns something, remember GIVING
Finally, if parameters are required they are given like:
MODIFY hExcel @Run("MyMacros.xlm!MyMacro", p1, .., pn)
Note, Excel does not allow objects to be passed as parameters to the run method.