Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
i need to delete all Expressions of a chart in module. In API Guide, is documented that RemoveExpression returns the number of remaining Expressions in chart. I Use something like this:
SET chart = ActiveDocument.GetSheetObject("CH01")
n = chart.RemoveExpression 0
But this dosn't work. When i write the second line like bellow:
chart.RemoveExpression 0
modul runs without problem. But the number of remaining Expressions is very important for me.
I will appreciate every idea.
Regards
Peyman
I can´t assign the returns to a variable.
If you want remove all expressions you must use chart.RemoveExpression all but I think you already know that.
set chart = ActiveDocument.GetSheetObject("CH01")
set cp = chart.GetProperties
x = cp.Expressions.Item(0).Count
You could count the number of expressions of each chart before remove all of them and use the sentence to remove all:
chart.RemoveExpression all
hope this helps,
Chema
Thank you Chema,
but "cp.Expressions.Item(0).Count" returns the number of subexpressions of first expression and "RemoveExpression all" is like "RemoveExpression 0". I think "all" is interprated as a variable with "0" value.
i tryed many ways and finally found out that the code belows has the correct result:
SET chart = ActiveDocument.GetSheetObject("CH01")
SET cp = chart.Getproperties
exprCount = cp.Expressions.Count
FOR i = 1 TO exprCount
chart.RemoveExpression 0
NEXT