Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Please see the sample attachment for clear understanding.
I am creating one straight table with expression and afterwards i am creating qvd for that.
Now after loading the qvd i am getting the total expression as a field.But i want to assign a label for that expression so,that i get that label as a field in the created qvd.
How can i do this?
Thanks...
Hi All,
I found the solution for the problem from API guide and i want to share this with you.
The macro code should be like this
Sub Create
set chart = ActiveDocument.ActiveSheet.CreateStraightTable
'chart.AddDimension "Sal"
chart.AddExpression "sum(Sal)"
chart.AddExpression "Avg(Sal)"
set cp = chart.GetProperties
set expr = cp.Expressions.Item(0).Item(0).Data.ExpressionVisual
set expr1 = cp.Expressions.Item(1).Item(0).Data.ExpressionVisual
expr.Label.v = "Good_Test"
expr1.Label.v = "Bad_Test"
expr.NumAdjust = 1 'center
expr.LabelAdjust = 1 'center
expr1.NumAdjust = 1 'center
expr1.LabelAdjust = 1 'center
chart.SetProperties cp
End Sub
But still i have the problem like no.of lines of code is increased if i have more no.of expressions.
So i need for loop to control this code.
Thanks...
Hi Ravi
'ADD the Expreesions
set f1=ActiveDocument.Fields("Measure_UA").GetPossibleValues
set f2=ActiveDocument.Fields("MeasureLabel_UA").GetSelectedValues
for j=0 to f1.count-1
Mnu1 = f1.Item(j).Text
chart.AddExpression Mnu1
'rename an expression label
set p = chart.GetProperties
set exps = p.Expressions.Item(j).Item(0).Data.ExpressionVisual
exps.Label.v = f2.Item(j).Text
chart.SetProperties p
next
p.ChartProperties.Title.Show=False
chart.SetProperties p
End Sub
Please check this code.