It's all about the answers!

Ask a question

Running Microsoft Word Macros with RPE!


David Gutierrez (111) | asked Apr 06 '20, 2:03 p.m.

Hello!

I have successfully made a formatting macro to run on microsoft word documents, verified that when I run the macro through word it works consistently.

I have an RPE template, that pulls information from Quality Manager and generates several different documents in one go. I then tried to get the RPE to run the macro for me by following the instructions of pointing to the correct style sheet and typing in the macro name of said stylesheet. The stylesheet is a macro enabled template.

RPE Launcher gives me no grief but when I go to click the documents, they have not had the formatting macro run on them. I have trouble shooted this to death and can't figure out how to the RPE template to run the macro as it processes each generated document.

Does anyone have any suggestions for root causing this? Does RPE not work for Microsoft Word document Macros?

Thank you for your time.

3 answers



permanent link
Sean F (1.3k241145) | answered Apr 06 '20, 2:10 p.m.
Hi David,

Have you got macro security settings set to minimum?

You might find you can run a macro manually but it won't run from RPE if the security settings are too strict.

If the macro exists in the stylesheet and you name the macro in the macro field in the specification field then it should work.

You might want to try modifying the specification/template to only generate one document for debugging purposes.

Maybe also try a simple dummy macro that just pops up an 'OK' box to test whether basic macro invocation is working.

permanent link
David Gutierrez (111) | answered Apr 06 '20, 2:15 p.m.

Hello Sean!

Thank you for your response.

By macro security settings, you mean the settings within Microsoft word? I have it set to enable anything with no notification needed. Are there other macro settings  you are referring to within  Word or RPE?

For debugging I did something similar where I just told the Macro to highlight text turquoise so that its easy to tell. So far no coloring will show up in the troubleshooting doc I have been running.

Is there any trick tot he macro name in the field? Say my macro is called "makeRed" would that be all I need to type in the field? do I need to include the "( )" from the code?


permanent link
Subramanya Prasad Pilar (4.6k15) | answered Apr 06 '20, 11:42 p.m.
edited Apr 06 '20, 11:43 p.m.

Can you please confirm if macro executim was really done. You should see the following messages in console/log:
Starting Word ...
Loading document ...
Running macro ...
Saving document ...
Macro execution finished

If macro is not executed, we need to check for settings/configurations. (will give details subsequently).

If macro is executed, how RPE's Word output being saved as? Is it .docx? Note that docx is a macro free document. Please try saving output as .doc or docm.


Comments
David Gutierrez commented Apr 07 '20, 2:25 p.m.

Thank you for that, I actually did not know about the console view. So after running the console vie wit seems I should update the context and problem.

Context: I run an RPE spec that produces several various reports, pulling information from around JTS  and then at the end combines all of the reports into one. So my output is anywhere from 1-50 reports and then the combination report.

Current Issue: It turns out, per the advice above, the RPE spec only generates one word document and runs the macro successfully once, and this occurs on the combined report document. So as things stand now, it does generate all the documents and the combination document, but the console seems to imply the combination document is the only document being generated, everything is just appearing by happenstance and that is why the macro isn't being run on each document.

I unfortunately, am not the author of the spec being used, so I will have to go dig into it a bit. Any high level advice for what I should be looking for for why RPE does not consider the other reports it is outputting as generated documents?

Thank you for your help with this!


Subramanya Prasad Pilar commented Apr 07 '20, 9:54 p.m.

Let me clarify on RPE spec producing several various reports. Do you mean multiple Word output files? If so, how it is achieved? Using Document Break element in the template or running document generation in batch mode?

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.