Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Call Macro from Load Script

I have the following Macro that I am trying to execute from the load script, but am having difficulties:

Sub Test_Extraction

  'Extract the data required to calculate diversification credit
SET myTable=ActiveDocument.GetSheetObject("CH1101")   'Data - Diversification / Par

  'Save the diversification credit tables to .csv files
myTable.Export "C:\Users\mridgley\Desktop\Manulife\Capital\R - QV Integration\Demo\NEW Macro Test\Dataset.csv",",",0

END SUB

I have tried to use Call Test_Extraction() but I continue to get an error.

I would appreciate any help / suggestions.

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

A couple of issues:

1. You cannot call Macro SUBs from the loadscript.  You can only call Macro Functions like this:

LET vx = MyFunction(x);

or

LOAD MyFunction(x) as myx, ...

2. The ActiveDocument object is not available during reload, so your code won't work no matter how called.

You may want to try triggering this Sub in a OnPostReload trigger. I haven't tried that for years, but ActiveDocument may be available there. 

-Rob

shaikbakshu
Contributor
Contributor

Hi Rob,

Thank you for this post,

Is it any Script (Edit Script) is available to export Edit Script to another location, Not using macros and -prj concept.

Like export System tables.

Can you please help me for this situation.

Thanks and regards,

Allabakshu.