Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
does anyone know if it is possible to set an option "Conditional" (+some condition) for the Expression in Chart Properties by Macros?
Thanks in advance!
Sincerely,
Justinas
Made it!
Sub ExpressionEnableCondition
Set chart = ActiveDocument.GetSheetObject("CH01")
Set cp = chart.GetProperties
Set expr = cp.Expressions
Set expr_data = expr.Item(0).Item(0).Data.EnableCondition
expr_data.Type = 2
expr_data.Expression = "here_goes_your_expression"
chart.SetProperties cp
End Sub
Hi, found this in API Guide:
CLASS = ICondExDef
MEMBER = Expression
EXAMPLE:
set chart=ActiveDocument.GetSheetObject("CH01")
set cp=chart.GetProperties
set dims=cp.Dimensions
set expr=cp.Expressions.Item(0).Item(0).Data.ExpressionData
dims(0).Show.Type=1 '0=false, 1=true, 2=cond
expr.Show.Type=2
expr.Show.Expression="sum(a)<10000"
chart.SetProperties cp
Hope this helps
Fernando
This won't work for me. Your example controls Columns Presentation option:
What I need is a different thing.
Made it!
Sub ExpressionEnableCondition
Set chart = ActiveDocument.GetSheetObject("CH01")
Set cp = chart.GetProperties
Set expr = cp.Expressions
Set expr_data = expr.Item(0).Item(0).Data.EnableCondition
expr_data.Type = 2
expr_data.Expression = "here_goes_your_expression"
chart.SetProperties cp
End Sub