Custom Properties: how to get them / value?

J

jeff_porter

Hello all,

I'm trying to write some VB code to get the value of a custom property.

I define the custom property via 'select shape' .. 'right click' ..
'shape' .. 'custom properties'.

I then set the 'Label' and the 'value'.


If I then inspect the object via its shape sheet.

I can see under the "Custom Properties" section..

Prop.Row_1 MY_LABEL1 No Formula 0 No Formula my_value1
Prop.Row_2 MY_LABEL2 No Formula 0 No Formula my_value2

Which is great, but I now want to get these values back via VB code.

I can get the custom properties via While loop and CellsExists test.

ie.
If (shp.CellExistsU("Prop.Row_1", visExistsAnywhere) = -1) Then
....

But this only allows me to get the Value in the cell, not the label.

I can't see how get the 'label' back, since the 'value' has no benefit,
unless I know what custom property is it linked to.

Anyone any ideas?

Thanks
Jeff

p.s.
shp.CellsU("Prop.Row_1").label doesn't give the label name.
shp.CellsU("Prop.Row_1").value DOES give the value.
 
J

John Goldsmith

Hello Jeff,

To get the a custom property's value use the cell's range of Result based
properties (see Help / Developer Reference to find the right one for you).
For example:

dblMyVariable = shp.CellsU("Prop.Row_1").Result(visInches)

Also to determine the correct row you could rename it to something useful as
you enter it into the ShapeSheet (eg Prop.Distance) and or get the label
name as follows:

strTempLabelName = shp.CellsU("Prop.Row_1.Label").ResultStr("")

Hope that helps.

Best regards

John


John Goldsmith
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk
 
J

jeff_porter

Thanks John!

The code..
shp.CellsU("Prop.Row_1.Label").ResultStr("")

is just what I'm trying to do!

Now all I need to do is work out how to create a custom property on a
new shape object.

Jeff Porter
 
J

John Goldsmith

J

jeff_porter

Hi John,

don't suppose you know a way to get all of the custom properties back ?

I want to copy all of the 'custom properties' from one shape to another.

cheers
Jeff

will look into the macro thing now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top