Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Reading Value of variable in Macro

Hi Community,

I have a situation where a QV variable is stored to retrieve the selected chart. as below:

Example: vGraph = if(Graph='Line', CH01,

                                   If(Graph='Bar', 'CH02')

vGraph is a QV variable.

I am trying to export the chart to excel and trying to implement the value of selection of graph here.

So instead of GetSheetObject(qvObjectId). Can i use  ActiveDocument.GetVariable("vGraph ") in macro ?? So as to get the get sheet Object ID

Thanks in advance.

2 Replies
perumal_41
Partner - Specialist II
Partner - Specialist II

try like below

set XLApp = CreateObject("Excel.Application") ' Define Object

XLApp.visible = true
Set XLDoc = XLApp.Workbooks.Add 'Open new workbook
set sheets = XLDoc.Sheets

ActiveDocument.GetSheetObject("CH01").CopyBitmapToClipboard

  
sheets(1).Paste

perumal_41
Partner - Specialist II
Partner - Specialist II

try like below

Sub Test
set XLApp = CreateObject("Excel.Application") ' Define Object

XLApp.visible = true
Set XLDoc = XLApp.Workbooks.Add 'Open new workbook
set sheets = XLDoc.Sheets

vGraph1=ActiveDocument.GetVariable("vGraph").GetContent.String

ActiveDocument.GetSheetObject(vGraph1).CopyBitmapToClipboard


sheets(1).Paste

End sub