Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
sifatnabil
Specialist
Specialist

Task Scheduler does not work with macro

Hi all,

I have a batch file setup on Windows Task Scheduler which works fine with the following code in the batch file:

echo off

echo.

echo Initialize the log file with Command Line reload...

echo Run QlikView and Reload Data...

"C:\Program Files (x86)\QlikView\Qv.exe" /r "C:\Users\bob\Dashboard.qvw"

However, the same batch file does not work if the Qlikview document has a macro that is triggered OnOpen. What might the issue be?

18 Replies
sifatnabil
Specialist
Specialist
Author

I just replied with the code but it has links for SMTP server so it says "Currently being moderated".

sifatnabil
Specialist
Specialist
Author

Hi, this is still not working. It still shows "Running".

jonathandienst
Partner - Champion III
Partner - Champion III

I don't think the OnOpen macro fires when your run with /r ??

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sifatnabil
Specialist
Specialist
Author

Really? What should I use then?

Peter_Cammaert
Partner - Champion III
Partner - Champion III

OnPostReload? But if the OnOpen trigger doesn't fire, then what is blocking your document?

jerrysvensson
Partner - Specialist II
Partner - Specialist II

OnOpen will fire when using /r.

Is it actions or macrocode?

Try to remove code until it works, then try to figure out what the problem is.

jerrysvensson
Partner - Specialist II
Partner - Specialist II

You are using Z:\ drive. If you log in as the service account, does Z drive exists then?

Has the service account correct security rights on that share?

I recommend using UNC instead of mapped drives.

Login as the service account and do a manual reload.

martin_dideriks
Partner - Contributor III
Partner - Contributor III

The only solution I have got to work so far is this:

Add this at the end of your macro.

  ActiveDocument.Save

  ActiveDocument.GetApplication.Quit

This will save the reloaded document and close the document when finished.

Your batchfile should look something like this:

"C:\Program Files\QlikView\qv.exe" /l /NoSecurity "C:\QV\ReportGenerator.qvw"

/l opens and reload the document (does not save and close like /r

/NoSecurity makes sure that you dont have to click a button to accept macros.

Hope it helps.

//Martin

sifatnabil
Specialist
Specialist
Author

Thanks all for your help. It seems even the other BAT file is not working which leads me to believe I may have lost local admin rights to run tasks when my user is logged off. I need the privileges to run tasks when logged off (run as a service) first. Thanks.