A
Anand Nichkaode
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.
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.