Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro for export to png not working fully

Dear forum,

I'm writing this macro to export a gauge chart into png image for all 12 months but it is stoping after 1 month only

sub exportpng
sheetobjects = ActiveDocument.ActiveSheet.GetSheetObjects
for each shobj in sheetobjects
objtype = shobj.GetObjectType
if(objtype = 22) then
set monthlb = ActiveDocument.GetSheetObject("LB07")
months = monthlb.GetPossibleValues

for each val in months
'ActiveDocument.Fields("month").Clear
ActiveDocument.Fields("month").Select val
'bitmapfilename = ImgFolder & "" & shobj.GetCaption.Name.v & "_" & val & ".gif" // this will generate file name
shobj.ExportBitmapToFile bitmapfilename
next

end if
next
end sub

Can anyone help where is the problem.

3 Replies
Not applicable
Author

You never clear your selection.

ActiveDocument.Fields("month").Select val 'You select one month and it will stay selected

Try ActiveDocument.Fields("month").Clear after shobj.ExportBitmapToFile bitmapfilename

Not applicable
Author

Jerry,

Nothing changed even after writing the line to clear the month List Box after shobj.ExportBitmapToFile line.

I have attached the qvw file. If anyone can help.

I want to Generate 12 png images for a gauge chart for all 12 months and then attach all 12 images in mail and send.

Using Qlikview 9 SR2

Not applicable
Author

Refering my attached qvw in my last post i have found out that

if i write msgbox(some message) then all 12 images are generated and ActiveDocument.GetApplication.Sleep 2000 not working at this point

the next line ExportBitmapToFile is blacked out by qlikview.

That means i need to insert some time between these 2 lines, how to do that ?