Problem with Shape.CellExists

Started by asfadel, July 31, 2020, 01:16:12 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

asfadel

Hello !
I'm trying to check name of user created cell of subshapes in a group, but Shape.CellExists method always return False. Here a code:

For Each vsoShape In shp.Shapes
           If vsoShape.CellExists("Prop.type", visExistsLocally) Then
                If vsoShape.Cells("Prop.type").ResultStr("") = "Device_name" Then
                    device = vsoShape.Text
                ElseIf vsoShape.Cells("Prop.type").ResultStr("") = "ID" Then
                    device_ID = vsoShape.Text
                End If
            End If
Next

Howether, if I'm typing for example:
           If vsoShape.CellExists("Width", visExistsLocally)
I can get this data from this user cells. What could be the problem ? How to resolve it ?

Nikolay

Maybe the problem is the cell name? I.e. "type" may be cell label (text you see in the user interface), not the name.
To get the name, use shapesheet (first column) or use developer mode, then it's displayed in the UI.

If you created the property using link to data wziard then most probably the name is "_VisDM_type" and you should use "prop._VisDM_type"


JohnGoldsmith

A couple of other things to check:



       
  • Are you sure the Shape Data exists at that level of the shape (ie not in a parent shape and not in a sub-shape of those sub-shapes?
  • Are you sure the Shape Data row is local? Does visExistsAnywhere produce different results?
John Goldsmith - Visio MVP
http://visualsignals.typepad.co.uk/

asfadel

Thank you for quick response, Nikolay and John ! I checked this moments, and found a problem. It was in visExistsLocally. As soon as I changed visExistsLocally to visExistsAnywhere the macro started working as it should.