Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
hie...
.bat file contains below code...
@ECHO OFF
"C:\Program Files\QlikView\qv.exe" /r "Path of your qlikview file"
ECHO Application Reload Completed!
Batch file is been schedule in task schedular..At what time you have to reload..
Hope this will help you
Regards,
Mohammad
Hi, it doesn't work if the Qlikview document has a macro triggered OnOpen.
It should work. What happens?
Nothing happens actually. It just says "Running". If I double click the batch file though, it works. Just not through Windows Task Scheduler. Are there any alternative task schedulers I could try out?
If you remove all actions from OnOpen does it work then?
Also, if Task scheduler runs on a different account then yours it needs a license, That is probably the issue here,
try this
"C:\Program Files (x86)\QlikView\Qv.exe;" /r "C:\Users\bob\Dashboard.qvw;"
Well it works with the other batch file, so license is not an issue. If I remove OnOpen, how do I make the Qlikview doc automatically run the macro?
Ok
Well it might be something in your macro that stops the loading process.
Can you give us the code?
Sure, I used the code to send PDF reports via email:
Sub Bonds
vReport = "RP19" 'Set report
vName = "Bonds" 'Name of output pdf
ActiveDocument.PrintReport(vReport), "Bullzip PDF Printer", false 'Printreport
reportFile = "Z:\Reporting\PDF Reports\" & vName &".pdf" 'Setting outputname
MyPrintPDFWithBullZip(reportFile) 'Call pdf printer
ActiveDocument.GetApplication.Sleep 5000
zendDagrapportBonds
End sub
function zendDagrapportBonds()
Dim objEmail
Const cdoSendUsingPort = 2 ' Send the message using SMTP
Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM
SMTPServer = "XXXX"
Const SMTPPort = 25 ' Port number for SMTP
Const SMTPTimeout = 60 ' Timeout for SMTP in seconds
'Sending mail
Set objEmail = CreateObject("CDO.Message")
Set objConf = objEmail.Configuration
Set objFlds = objConf.Fields
With objFlds
'---------------------------------------------------------------------
' SMTP server details
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = SMTPTimeout
.Update
'---------------------------------------------------------------------
End With
vName = "Bonds"
vName2 = "CDS"
strbody = "Hi Lee/Grant" & vbNewLine & vbNewLine
objEmail.To = "sifat" 'Email Recipient
objEmail.From = "sifat" 'Email Sender
objEmail.cc = "sifat"
objEmail.Subject = "Desk Report" ' Subject
objEmail.TextBody = strbody
objEmail.AddAttachment "Z:\Reporting\PDF Reports\" & vName &".pdf" ' Attachement
objEmail.AddAttachment "Z:\Reporting\PDF Reports\" & vName2 &".pdf" ' Attachement
objEmail.Send
Set objFlds = Nothing
Set objConf = Nothing
Set objEmail = Nothing
end function
FUNCTION MyPrintPDFWithBullZip (pdfOutputFile)
set obj = CreateObject("Bullzip.pdfSettings")
obj.PrinterName = "Bullzip PDF Printer"
obj.SetValue "Output" , pdfOutputFile
obj.SetValue "ConfirmOverwrite", "no"
obj.SetValue "ShowSaveAS", "never"
obj.SetValue "ShowSettings", "never"
obj.SetValue "ShowPDF", "no"
obj.SetValue "RememberLastFileName", "no"
obj.SetValue "RememberLastFolderName", "no"
obj.SetValue "ShowProgressFinished", "no"
obj.SetValue "ShowProgress", "no"
obj.WriteSettings True
END FUNCTION