Discussion Board for collaboration related to QlikView App Development.
I have a document with a macro at the OnPostReload. In this macro I want to export several images with different selections. The macro looks like this:
sub exportGraphToDisc
GraphPath = "c:\ba"
ActiveDocument.Fields("MAINLOCATION").Select "Ula"
ActiveDocument.Fields("LOCATIONCODE").Select "ULA"
ActiveDocument.Sheets("Main").ExportBitmapToFile GraphPath & "a1.jpg"
ActiveDocument.Fields("MAINLOCATION").Select "Valhall"
ActiveDocument.Fields("LOCATIONCODE").Select "VAL"
ActiveDocument.Sheets("Main").ExportBitmapToFile GraphPath & "a2.jpg"
end sub
What happens is that when the macro is finished, the document show correct on the scrren, but both images are identical and shows the values as they were before the macro was started. It looks like the export is executed correct, but that the Select statements are running after the macro has been closed. Does somebody know if it is possible to force the execution of the ExportBitmapToFile inside the macro or are there any other solution?
Thanks
It's possible that the chart hasn't finished responding to your selections by the time you export. To force it to wait for the changes to complete, use ActiveDocument.GetApplication.WaitForIdle between setting the fields and exporting the image. I'm guessing that will work. Worth trying, anyway.
It's possible that the chart hasn't finished responding to your selections by the time you export. To force it to wait for the changes to complete, use ActiveDocument.GetApplication.WaitForIdle between setting the fields and exporting the image. I'm guessing that will work. Worth trying, anyway.
Many thanks! That solved the problem!