Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
Guidok
Contributor II
Contributor II

Macro doesn't work on postreload

Hi,

I've a macro for exporting an excel file which works fine when I run the script manually.

When I add it to a postreload trigger, it doesn't.

I've checked the document properties -- security --> Export allowed

Also under user preferences --> security --> Module and File are checked

Any idea suggestions why the macro doesn't seem to work as a postreload?

Regards,

Guido

 

35 Replies
Guidok
Contributor II
Contributor II
Author

I've added this as the first macro:

sub x
msgbox "start"
msgbox "mid"
msgbox "end"
end sub

and then ran the script. I didn't get any messages so it seems like the macro's don't run at all.

marcus_sommer
MVP & Luminary
MVP & Luminary

Take another look to the above provided links to the there mentioned security settings.

- Marcus

Guidok
Contributor II
Contributor II
Author

I think these should be the settings. It's in Dutch, but it's Exports allowed and Macro security cancelled:

Security1.jpg

And Module and File are allowed.

Security2.jpg

marcus_sommer
MVP & Luminary
MVP & Luminary

By the user-properties enable all unless the last one.

Guidok
Contributor II
Contributor II
Author

Security.JPG

I've changed the settings but still no excel export. 

marcus_sommer
MVP & Luminary
MVP & Luminary

Just to be sure - no Excel and QV is running, means no open files or any other instances of the tools could impact the task. Then you starts the batch-file manually - what happens? Open + reload then will be a msgbox displayed?

- Marcus

Guidok
Contributor II
Contributor II
Author

Excel and QV are closed. I run the bat file and a cmd window opens, the window is empty.

Then QV opens and the reload starts.

That's it. QV stays open and the cmd window is still empty.

marcus_sommer
MVP & Luminary
MVP & Luminary

The within the OnPostReload trigger specified macro is the correct one - also from the spelling?

To exclude that anything prevents the displaying of the msgbox popup's (they might be also hiden or outside of the screen) change/add to a selection-statement like:

ActiveDocument.Fields("Year").Select 2019

or something similar - you should now see the new set selection.

- Marcus

Guidok
Contributor II
Contributor II
Author

I have only 1 macro in the whole document.

When I run it manually, I see the message.

I've added a filter in the statement like you suggested, but it doesn't change when I run it with the script. It does change when I run the macro manually.

marcus_sommer
MVP & Luminary
MVP & Luminary

Some setting prevents the macro-execution. Within the script-editor in the bottom left area there are multiple buttons like Data, Functions, Variables and Properties - within the properties are also options for the execution of external programs.

Another trial would be to remove (with backup) or a renaming of the Qlikview settings.ini in:

C:\Users\YourUser\AppData\Roaming\QlikTech\QlikView

and now you should be asked if you want to execute any macros.

- Marcus