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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro- Question

Hi,

I am a newbie to QV and Macro world. Please bear with me if this is a silly question. I have created a qlikview document with two sheets sheet1 and sheet2 and each sheet has bunch of charts. I have a created a macro to export the charts from sheet 1 and it works fine. The issue I am facing is when I try to create a macro for the second sheet, the code I put in is overwriting the code on macro 1 on sheet 1. so is there a way to isolate the two macros? is there a better way of doing this? Please help

6 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

There's only one module per document to put macro code in. You need to give the different macro's their own name and use those names to call the macros.

Sub ExportSheet1

    ...do sheet1 export stuff here...

end Sub

Sub ExportSheet2

    ...do  sheet2 export stuff here...

end Sub


talk is cheap, supply exceeds demand
Siva_Sankar
Master II
Master II

Hi, Attached the qvw file. Look and let me know is that you want. Regards. Siva

Not applicable
Author

Siva,

I am on personal edition so cannot open the Qvws created by others. Can you please put your code here in this thread? Appreciate your help.

Not applicable
Author

Issue is I am unable to export charts on sheet2 when I put everything in the same module. May be I am missing something.

anandathome
Creator
Creator

Hi Arjun,

    You can find relevant code at:

http://www.qlikblog.at/971/qliktip-32-exporting-multiple-objects-single-excel-document/

This should really help you.

-Anand.

Siva_Sankar
Master II
Master II

sub exportToFolder ChartPath = "D:\QV Export" ActiveDocument.GetSheetObject( "CH01").ExportBitmapToFile ChartPath & "B.jpg" ActiveDocument.GetSheetObject( "CH02").ExportBitmapToFile ChartPath & "D.jpg" end sub