May 29, 2013 2:55:54 PM
This example shows how to call a macro that saves image files for a selected sheet and chart to a specified location on reload.
The saved images could then be published via a web site or Wall Board, for example.
This QlikView was written in response to a post in the QlikView UK user group.
For other tutorial apps you can download and use, please see:
Hope you find this app useful.
I've not used this app, or even this technique, in a long time. We tend to recommend NPrinting, which makes this much more configurable (but it does carry a price tag).
I've just downloaded and tried the app, and for me when I click the button two files are exported to the same folder as the QVW (using QV 12.1).
When you opened the file, did it prompt you to allow macros? Did you click to say that you would allow macros? This can be changed under Tools \ Edit Module if you gave the wrong response on loaded. Also check you have permission to write to where the QVW is stored.
I also noticed a slight glitch in the code, it writes two files and if the time is exactly the same the second overwrites the first. Obviously when I first wrote this the first file always took more than a second to write (or I didn't test it enough). In the module change the prefix of one of the files, eg:
fileName = "ExportScreen_" & replace(replace(replace(date() & "_" & time(), "/", ""), ".", ""), ":", "") & ".png"
Hope that helps,
as always a great issue
thanks a lot
Due to budget issues we will not be going in for Nprinting for sometime but we have few mundane report generation tasks that take up couple of unnecessary hrs on weekly basis.
My requirement is to export 6 specific graphs for certain products from Qlikview on a weekly basis and have these sent via Outlook. Underneath each graph there one or two lines of text that I need to enter. The text is more less fixed. I only edit the numbers in the text.
I copy paste these graphs in an excel sheet then again copy paste them in outlook and enter few lines of text underneath these graphs and then send the email..
what I am looking at is there a way I can do these things via macro i.e. handle export of these 6 graphs in the desired format in outlook like a stationery that has the format of the report. I need to merely change the numbers every week in the predefined lines of text every week.
Your suggestions are welcome
The macro language in QlikView is VBScript based, so you should be able to instantiate objects that allow you to do SMTP sending with attachments (you may need to find a plugin to install to help with this ASPEmail is one I used in a past life).
Something to watch is that not all macro features will fire on a QVServer reload task. Try it out and see what you get. If your macro works in Desktop but not from QMC try triggering the reload from Windows Scheduler, using the QV.exe command line with a /r switch.
If you can get the export working (as per this thread) but email does not work from the macro, you may find using the Qlik Web Connectorr SMTP connector a good alternative. I've got this working well for sending HTML emails created on the fly during Sense load scripts to automate the sending of data without NPrinting - it will work in QlikView also.
See here for more info on free Web Connectors: