Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Runs Twice
Hi all,
We are using Excel for reporting in our organization. Basically there is a Java web application which instantiates Excel 2007 with an XLAM. This XLAM opens a Report Template(an .xls, .xlsm file, name supplied as command line parameter). The Template has a datasheet where we have multiple ranges and the Reportsheet which shows the final report based on the data from the Datasheet. The Reportsheet contains formulas to show the final output. It could contain Charts/Graphs also. The data is fetched from SQL server and is pasted on the Ranges. And finally when all the data is pasted and Macro is run the Template is saved as a Final Report somewhere on the Report Server. The Excel runs in the background in all this process. There could be multiple instances of Excel running on the same box. The instances run under separate WindowStation. In this process depending on the options selected by the end user, the Report options are applied on the final report workbook. The some of the Report options are Run User Macro, Protect Workbook, Protect Worksheets, Delete Macro code, etc. I am facing a problem when it comes to running user Macro. This is how I execute the macro present in the templte. Application.Run(<macro name) The <macro name passed above could have parenthesis in it e.g. "MacroTest()" or the <macro name could have parameters e.g. "MacroTest(1, 1231)" If the <macro name is not stripped off the parenthesis then the macro gets executed twice. When the macro has parameters then the parenthesis could not be stripped off and the macro gets executed twice. If anybody have any idea please let me know as it is a blocking issue in our process. Any help appreciated. Thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Runs Twice
|
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Runs Twice
Remove the ()'s.
Application.Run(<macro name) should be Application.Run <macro name Anand Nichkaode wrote: Hi all, We are using Excel for reporting in our organization. Basically there is a Java web application which instantiates Excel 2007 with an XLAM. This XLAM opens a Report Template(an .xls, .xlsm file, name supplied as command line parameter). The Template has a datasheet where we have multiple ranges and the Reportsheet which shows the final report based on the data from the Datasheet. The Reportsheet contains formulas to show the final output. It could contain Charts/Graphs also. The data is fetched from SQL server and is pasted on the Ranges. And finally when all the data is pasted and Macro is run the Template is saved as a Final Report somewhere on the Report Server. The Excel runs in the background in all this process. There could be multiple instances of Excel running on the same box. The instances run under separate WindowStation. In this process depending on the options selected by the end user, the Report options are applied on the final report workbook. The some of the Report options are Run User Macro, Protect Workbook, Protect Worksheets, Delete Macro code, etc. I am facing a problem when it comes to running user Macro. This is how I execute the macro present in the templte. Application.Run(<macro name) The <macro name passed above could have parenthesis in it e.g. "MacroTest()" or the <macro name could have parameters e.g. "MacroTest(1, 1231)" If the <macro name is not stripped off the parenthesis then the macro gets executed twice. When the macro has parameters then the parenthesis could not be stripped off and the macro gets executed twice. If anybody have any idea please let me know as it is a blocking issue in our process. Any help appreciated. Thanks in advance. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs | Setting up and Configuration of Excel | |||
Macro runs upon wkbk open, but no Workbook_Open or Auto_Open Macro | Excel Programming | |||
One macro runs then it auto runs another macro | Excel Discussion (Misc queries) | |||
Which Macro Runs...? | Excel Discussion (Misc queries) | |||
Macro runs in source , but not when in Personal Macro Workbook | Excel Programming |