Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
eliran
Creator III
Creator III

Batch to run macros

Hi all,

I have to send a report by mail each day except the weekend on a specific hour.

The report is exported from qlikview by a macro - sending the object to excel and designing it.

As for the mail itself I'm using a cdo object inside a vbs file and running it with cscript.

The model is reloaded everyday at 18:30 and the report needs to be sent after that.

The problem: How can I run the macro by schedule?

I tried a trigger after reload but apparently the trigger is not executed when reloading using a batch file.

Thanks for any help,

Eliran.

1 Solution

Accepted Solutions
eliran
Creator III
Creator III
Author

Well, I did a bit awkward solution..

I created a second model which binary loads the original model.

In this tmp model I created onpostreload trigger which activates the desired macro.

I then created a batch file that reloads the tmp model with /l attribute.

And then a second batch file that uses taskkiller.exe to end the task after few minutes.

All this because the /r attribute is not triggering the onpostreload compared to the /l which does.

If anyone has a more appropriate approach I'll be glad to hear, and if anyone needs any help with the above solution I'll be happy to assist.

Regards,

Eliran.

View solution in original post

3 Replies
eliran
Creator III
Creator III
Author

Well, I did a bit awkward solution..

I created a second model which binary loads the original model.

In this tmp model I created onpostreload trigger which activates the desired macro.

I then created a batch file that reloads the tmp model with /l attribute.

And then a second batch file that uses taskkiller.exe to end the task after few minutes.

All this because the /r attribute is not triggering the onpostreload compared to the /l which does.

If anyone has a more appropriate approach I'll be glad to hear, and if anyone needs any help with the above solution I'll be happy to assist.

Regards,

Eliran.

Not applicable

Dear Eliran,

Can u please provide me a Sample application of urs to send the reports everyday.

It will be very useful for me,

Regards,

Sandeep

gandalfgray
Specialist II
Specialist II

Well

we use the /l switch running a .qvw in commandline mode (batch).

Since /l does not save and close the qvw but triggers OnPostReload

the trick is to make OnPostReload call a macro that finishes with:

  ActiveDocument.Save

  Application.Quit

Before that you can let the macro send mail or whatever you like.

That is how we do it.

hth/gg