CellExists for custom property always returns true, even if property does not exist.

J

Jan DOUMEN

Ave,

When trying to check if a selected shape has a certain custom
property or not, I bumb into a problem. The code below always
seem to return 'yep', no matter if the 'Flow_ID' property exists
or not. Any suggestion on what I might be doing wrong?

Greetings,

Public Sub CheckIt()

Dim Item As Shape

If ActiveWindow.Selection.Count <= 0 Then
MsgBox "Please select a shape!"
ElseIf ActiveWindow.Selection.Count > 1 Then
MsgBox "Please select only one shape at a time!"
Else
Debug.Print ActiveWindow.Selection.Item(1).Name
Set Item = ActiveWindow.Selection(1)
With Item
If .CellExists("Prop.Flow_ID", False) Then
Debug.Print "nope"
Else
Debug.Print "yep"
End If
End With
End if

End Sub
 
D

Dawn Wright [MSFT]

Jan,

When I tried your macro, it does successfully change the answer depending on
whether the cell exists or not. It looks like you accidentally switched
around "nope" and "yep" so it prints "yep" when it does NOT exist.
 

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