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

Macro Msgbox

Hi,

is it possible to set a timer for a msbox, so that a messagebox appears e.g. for 5 seconds, after this 5 seconds the macro should be executed further.

My problem is that "ActiveDocument.GetApplication.Sleep 5000" / Application.Sleep(5000)/ Waitforidle don't working if I open the qlikview application from server. (Anyone got this working when opening from server? ). Errormessage says that macro has no functionality. Although it works on my local machine. I can execute the macro with the client installed on the server. Problem is opening it with local client from server or with e.g. ie plugin.

If anyone has a solution please let me know. Thanks.

I know it's not best practice but how would a waiting loop like? Sry I'm a newbie to vbscript.

Script:

function printReportPDF(reportID, pdfOutputFile)
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite "HKCU\Software\QlikViewPDF\OutputFile", pdfOutputFile, "REG_SZ"
WSHShell.RegWrite "HKCU\Software\QlikViewPDF\BypassSaveAs", "1", "REG_SZ"


ActiveDocument.PrintReport reportID, "QlikViewPDF", false
ActiveDocument.GetApplication.Sleep 5000
'ActiveDocument.WaitForIdle

'WSHShell.Sleep 5000 // also not working

msgbox ("Pause") // otherwise the pdfs aren't generated (only last one)

set WSHShell = nothing
end function

Regards

Aloah

4 Replies
disqr_rm
Partner - Specialist III
Partner - Specialist III

Try following instead of msgbox:

ActiveDocument.ShowPopup "Pause", 2000

You can also provide 3rd and 4th parameters to set it's colors. Look into APIGuide for details.

Not applicable
Author

Hi Rakesh,

tried that. Problem is the application doesn't really pause. I have absolutely no idea how to pause the application from printing without using
.sleep / idle.

disqr_rm
Partner - Specialist III
Partner - Specialist III

Where you calling this function from? QV Script or a VB Sub?

Not applicable
Author

I'm calling the function from vb sub.

sub printReport

' Print report to PDF
'ActiveDocument.GetApplication.Sleep 5000 // tried sleep here -> also not working
printReportPDF reportID, reportFile

end sub