Skip to main content
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Running Macro Inside Template

Hi,

I've created an Excel template (.XLSM) which contains a macro that's suppose to AutoRun every time the file is opened. However, when NPrinting is creating a report using this template, the macro does not run. But when I go to edit my template inside the report editor, the macro in the background runs without any problems.

My question is, why is it when I run a task and NPRINTING uses my macro enabled template to create a report, the macro does not run?

2 Replies
Daniel_Jenkins
Specialist III
Specialist III

Hi Omar,

I take it that you are using NPrinting 16.x (as 17.x does not support macro enabled Office documents). Take a look at this example that uses a macro enabled workbook template that creates a Table of Contents when opened: Index on page loop excel

HTH - Daniel.

Not applicable
Author

Hi Daniel,

That is correct, I am using NPrinting 16.4 currently. My macro enabled template adds in the fields which are used to pull data from my QV application. The problem is, that when NPrinting runs the report. It uses the template but the macro does not run. The report is then generated without returning any data. Please see below screenshots for a better explanation. When I open the template inside the template editor, the macro runs fine without any issues. The problem is just when NPrinting uses the template to create the report, it does not open the template it seems.

Below are the fields the macro copies automatically when the template is opened

po3.png

The macro then pastes the fields below into sheet1. So now when the report is ran, Nprinting should look for the values of these fields inside the QV application and update row 3. The data should be similar to row 2 which used the same fields. Instead, nothing returns because the template I believe is not opened when the report is generated which causes the fields to not be copied over into row 3 which returns no values.

po4.png