Custom property exists?

F

faramir

Hi

I have made a function, that takes the value from a custom property ID
on a shape. Then uses this id to collect the other custom property
values from a DB.
The thing is this works fine on shapes that are not grouped. I have
made one shape, a box and two ekstra text field piping to two
different custom properties. The custom properties are on the group.

I drop the shape gives it an ID, and runs my function and nothing
happens. I know it gets the ID, and collects the values in the DB, but
shape.CellExistsU("prop." + name, 1) returns false, so the values
aren't set on the shape.

Then i tried to write a value in every property on the shape manual,
just something like "asldfkj". And when i run the function now
shape.CellExistsU("prop." + name, 1) suddenly returns true.

Here is the code i use to set the property

If shape.CellExistsU("prop." + name, 1) Then
shape.Cells("prop." + name + ".value").FormulaU = _
StringToFormulaForString(values.getString)
End If

"values" is an object that contains strings

Have anybody experienced the same problem and come up with a solution?

Soren
 
C

Chris Roth [ Visio MVP ]

You don't need .name for custom properties.
Make sure the second argument in CellExistsU makes sense. I usually use
visExistsAnywhere.
If you group shapes, you bury the custom properties. You need to recurse
into the group to get the subshapes.

Some key phrases:

shpGroup.Shapes.Count
shpGroup.Shapes(1).CellExists
shpGroup.Shapes.Item(2)...

--

Hope this helps,

Chris Roth
Visio MVP
 
S

Søren Dalsgaard

Chris said:
You don't need .name for custom properties.
Make sure the second argument in CellExistsU makes sense. I usually use
visExistsAnywhere.
If you group shapes, you bury the custom properties. You need to recurse
into the group to get the subshapes.

Some key phrases:

shpGroup.Shapes.Count
shpGroup.Shapes(1).CellExists
shpGroup.Shapes.Item(2)...
Hi

I know that one has to recurse through group, to get the subshapes.
But the custom properties are on the group not the subshapes.
And as i wrote the function works fine, when i have typed something
manual in the custom property. It is as if the custom property dosen't
realy exist, before one types something in it. I can see the custom
property on the shape, but the program can't find it with the
CellExistsU.

I use the .name to specify which custom property to set.

Soren
 

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