Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
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
Partner
Partner

Re: Reading Value of variable in Macro

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

Partner
Partner

Re: Reading Value of variable in Macro

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