Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
All gurus
I have a button in my documents that selects a few default fields and then prints out a report.
I would like to press this button automatically when a reload of data is performed between 5-6 AM every day.
At the very end of the Data Load script I have this call:
If Hour(Now()) > 4 AND Hour(Now()) < 6 then
Let X = fPressButtonPrintReport(1) ' passing a dummy value to the function. Returned results are discarded
End if ;
A function in the Edit Module is as such:
Function fPressButtonPrintReport(A)
ActiveDocument.GetSheetObject("BU382").Press
fPressButtonPrintReport = 1
End Function;
(Only functions can be called from the data load script.)
When calling the function manually from within the document it works correctly however it does not when it is called from the Load Script.
Is there a way to activate the button so that the Report prints out automatically?
Thanks
I found this thread. This might be the only way to get this work as described.
It's not possible to execute such macro during the load because it requires an ActiveDocument which didn't exists at this time else it will be created after the load has finished. But it's possible to execute such macros with a OnPostReload-trigger whereby in this case you could call the print-report directly without the detour with pressing the button.
Important is further that such measures don't work if the reload is executed from the qmc because the qvb.exe runs the reload without an UI. Quite similar is the behaviour when running it from the cmd with the parameter /r. This means you need to use the parameter /l which keeps the application open and then you will need additionally measures like implement a quit-statement to get such things automated. More background could you find here: Solved: Sending mails macro vbs - Qlik Community - 390730.
- Marcus