Change the name of a custom property

S

Sam Huang

Hi,
I use the following code to get the name of a custom property:

string name = shape.get_CellsSRC(
(short)VisSectionIndices.visSectionProp, 3, (short)
VisCellIndices.visCustPropsLabel).Formula;

but wehn i tried to rename the property by calling
shape.get_CellsSRC(
(short)VisSectionIndices.visSectionProp, 3, (short)
VisCellIndices.visCustPropsLabel).Formula = "Hello";

I get a non-sense message as
#NAME?

Any one can help on renaming the custom property? Thx!
 
S

Sam Huang

Hello Sam,

You can change the row name using the RowNameU property instead of .Formula.

Best regards

John

John Goldsmithwww.visualSignals.typepad.co.ukwww.visualSignals.co.uk

Thx a lot for the answer it works! What if I also want to change the
label of the shape? Thx!
 
M

Mark Nelson [MS]

When you set the Formula property on a cell, you are specifying a Shapesheet
expression. Visio doesn't have any Shapesheet function or cell named Hello,
so that is invalid. What you really mean is to put the string "Hello" in
the cell. You specify a string by wrapping your text in quotes. But be
careful. You need one set of quotes in your code to make VB or C# know you
have a string, and you need the string itself to have a set of quotes that
get put in the Visio cell.

To keep things straight, try this when setting strings (VBA syntax for
reference):
.... Formula = Chr(34) + "String Text" + Chr(34)

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Sam Huang

When you set the Formula property on a cell, you are specifying a Shapesheet
expression. Visio doesn't have any Shapesheet function or cell named Hello,
so that is invalid. What you really mean is to put the string "Hello" in
the cell. You specify a string by wrapping your text in quotes. But be
careful. You need one set of quotes in your code to make VB or C# know you
have a string, and you need the string itself to have a set of quotes that
get put in the Visio cell.

To keep things straight, try this when setting strings (VBA syntax for
reference):
... Formula = Chr(34) + "String Text" + Chr(34)

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.

Thank you Mark!
 
Top