Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
arnoqlik
Contributor III
Contributor III

Close Qlikview software using VB Script

Hello,

Here is below the code I use to take a screenshot of an application. I managed to close the app but I don't find a way to close Qlikview.

set Qv = CreateObject("QlikTech.QlikView")
Set QvDoc = Qv.OpenDoc ("D:\…\Application.qvw","","")

QvDoc.GetApplication.WaitForIdle
QvDoc.Sheets("Sheet Name").ExportBitmapToFile "D:\…\Screenshot.jpg"

QvDoc.CloseDoc()


QvDoc.GetApplication.Quit closes the software but it generates a popup saying that Qlikview has stopped working.
Killing the process on the server seems too brutal for me.

Thank you for your help.

10 Replies
arnoqlik
Contributor III
Contributor III
Author

I don't have enough knowledge to find a perfect process and there are limitations from my external scheduler (not QMC).

I finally found this solution:

1. Duplicate the application and insert these macros when the document is open (OnOpen trigger):

 

Sub AutoReload
ActiveDocument.Reload
ActiveDocument.Save
End Sub

sub export
ActiveDocument.GetApplication.WaitforIdle
ActiveDocument.ActiveSheet.ExportBitmapToFile "D:\QLIKVIEW\…latest_screenshot.jpg"
ActiveDocument.GetApplication.Sleep 1000
ActiveDocument.GetApplication.Quit
End sub

 

2. Create a small cmd to open the application:

 

start "" "D:\QLIKVIEW\…\Application.qvw"

 

The application and the Qlikview client are properly closed.
This duplicate application is of course reloaded before this process.

Thank you again for your time.

Note: well I hope it's the final solution for my needs 🙂