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 code to check Show Legend on chart

Hi,

I'm trying to create a macro that would "check" the Show Legend on the presentation tab of my chart (CH28) but my code doesn't seem to work. Thanks in advance for your help!

showlegend.png

1 Solution

Accepted Solutions
Not applicable
Author

figured it out...here is the code:

sub SetLegend

set Graph = ActiveDocument.GetSheetObject("CH28")

set p = Graph.GetProperties

set cp = p.ChartProperties

set leg = cp.Legend

if  leg.Show = false then

leg.Show = true

else

leg.Show = false

end if

Graph.SetProperties p

end sub

View solution in original post

1 Reply
Not applicable
Author

figured it out...here is the code:

sub SetLegend

set Graph = ActiveDocument.GetSheetObject("CH28")

set p = Graph.GetProperties

set cp = p.ChartProperties

set leg = cp.Legend

if  leg.Show = false then

leg.Show = true

else

leg.Show = false

end if

Graph.SetProperties p

end sub