Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I have a macro that adds expressions dinamicaly. I need the expressions added had a label.
How can I set a label in a graph´s expression in a macro???
Thanks
Muy buenas
Tengo una macro que añade las expresiones de un gráfico dinámicamente cada vez que recargamos el script. En dichas expresiones, necesito que en vez de la fórmula de la expresión me muestre una etiqueta.
¿Cómo puedo hacer que muestre una etiqueta?
Muchas gracias.
Here's an example from the QV11 com api:
set chart = ActiveDocument.ActiveSheet.CreateStraightTable
chart.AddDimension "Customer"
chart.AddDimension "ProductType"
chart.AddExpression "sum(Amount)"
set cp = chart.GetProperties
set expr = cp.ExpressionVisuals(0)
expr.Label.v = "Sales"
expr.LabelAdjust = 2
chart.SetProperties cp
The lines in blue are what you're looking for. The example creates a new chart, but for an existing chart you can use activedocument.getsheetobject("ObjectID")
Here's an example from the QV11 com api:
set chart = ActiveDocument.ActiveSheet.CreateStraightTable
chart.AddDimension "Customer"
chart.AddDimension "ProductType"
chart.AddExpression "sum(Amount)"
set cp = chart.GetProperties
set expr = cp.ExpressionVisuals(0)
expr.Label.v = "Sales"
expr.LabelAdjust = 2
chart.SetProperties cp
The lines in blue are what you're looking for. The example creates a new chart, but for an existing chart you can use activedocument.getsheetobject("ObjectID")
This is the solution
set chart = ActiveDocument.ActiveSheet.CreateStraightTable
chart.AddDimension "Customer"
chart.AddDimension "ProductType"
chart.AddExpression "sum(Amount)"
set cp = chart.GetProperties
set expr = cp.Expressions.Item(0).Item(0).Data.ExpressionVisual
expr.Label.v = "Sales"
chart.SetProperties cp