Visio Guy

Visio Discussions => Programming & Code => Topic started by: asfadel on July 31, 2020, 01:16:12 PM

Title: Problem with Shape.CellExists
Post by: asfadel on July 31, 2020, 01:16:12 PM
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 ?
Title: Re: Problem with Shape.CellExists
Post by: Nikolay on July 31, 2020, 02:05:10 PM
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"

(https://i.paste.pics/9PBSN.png)
Title: Re: Problem with Shape.CellExists
Post by: JohnGoldsmith on August 01, 2020, 06:44:11 AM
A couple of other things to check:


Title: Re: Problem with Shape.CellExists
Post by: asfadel on August 01, 2020, 09:16:04 AM
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.