Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Andrius45
Contributor III
Contributor III

How to define chartArray with variable?

Hey guy,

I am trying to modify Macro for exporting certain tables to Excell. The only problem is that right now those tables are hard coded into macro and I need to change that to variable. Any help would be much appreciated.

Right now part of my code looks like this:

chartArray = Array("CH944", "CH893", "CH863", "CH878")

Array("CH01", "CH02"))

    usedRows=0

    For Each chart In chartArray

    Set l = ActiveDocument.GetSheetObject(chart)

    chartCaption = l.GetCaption.Name.v

I would like to switch  this part Array("CH944", "CH893", "CH863", "CH878") with a variable, any ideas on how can I accoplish that??

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hi Andrius,

Have a look at the attached file.

Sub Test

vArray = ActiveDocument.GetVariable("vChart").GetContent.String

chartArray =split(vArray, ",")

 

For each chart in chartArray

Set l = ActiveDocument.GetSheetObject(Chart)

chartCaption = l.GetCaption.Name.v

Msgbox chartCaption

Next

     

End Sub

Let us know.

View solution in original post

3 Replies
tamilarasu
Champion
Champion

Hi Andrius,

Have a look at the attached file.

Sub Test

vArray = ActiveDocument.GetVariable("vChart").GetContent.String

chartArray =split(vArray, ",")

 

For each chart in chartArray

Set l = ActiveDocument.GetSheetObject(Chart)

chartCaption = l.GetCaption.Name.v

Msgbox chartCaption

Next

     

End Sub

Let us know.

Andrius45
Contributor III
Contributor III
Author

Thanks alot Tamil, it worked!

tamilarasu
Champion
Champion

No problem Andrius. Happy weekend .