I need to ensure a Macro which works on Visio 2003 doesn t cause problems on lower versions of Visio: specifically because I m writing to a property which doesn t exist on lower versions of Visio. Currently I m doing this:
...
On Error GoTo NoComplexScriptFont:
Set cellObject = shapeObject.Cells("Char.ComplexScriptFont")
On Error GoTo ErrHandler
...
NoComplexScriptFont:
Rem MSGBOX only for debug
MsgBox "No Such Property"
GoTo endsub
ErrHandler:
Rem put in general error handling here
GoTo endsub
endsub:
End Sub
...
Which works, but its a little messy I think. I have toyed with the idea of using Application.version (Which returns 11 for Visio 2003), but I would like to avoid assumptions about what properties are available in any particular release and just test for the property itself.
What s the nice proper idiom for doing this in VBA ?
Thanks
--- Got a few answers below, my preferred solution was this one:
If shapeObject.CellExists("Char.ComplexScriptFont", 0) Then
msgbox "Property exists"
else
msgbox "Property does not exist"
end if