Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor

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
Highlighted
MVP & Luminary
MVP & Luminary

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

Highlighted
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.