ObjectType Property [Visio 2003 SDK Documentation]
Returns an object's type.
intRet = object**.ObjectType**
intRet Integer. The type of the object.
object Required. An expression that returns an object in the Applies to list.
Version added
4.1
Remarks
Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes.
Example
This function shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.
Public Sub ObjectType_Example()
Dim vsoShape As Visio.Shape
Dim vsoShapes As Visio.Shapes
Dim vsoPage As Visio.Page
Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5
Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625
Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7#
Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25
Application.ActiveWindow.SelectAll
ActiveWindow.DeselectAll
ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect
ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect
ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect
ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect
ActiveWindow.Selection.Group
Set vsoPage = ActivePage
Set vsoShapes = vsoPage.Shapes
Set vsoShape = vsoShapes.Item(2)
Call GetTopShape(vsoShape)
End Sub
Function GetTopShape(vsoShape As Visio.Shape) As String
Dim vsoShapeParent As Object
Dim vsoShapeParentParent As Object
Set vsoShapeParent = vsoShape.Parent
If vsoShapeParent.ObjectType = visObjTypeShape Then
Set vsoShapeParentParent = vsoShapeParent.Parent
'If vsoShapeParent's parent isn't a page, keep going up.
If vsoShapeParentParent.ObjectType = visObjTypePage Then
GetTopShape = vsoShapeParent.Name
Else
GetTopShape = GetTopShape(vsoShapeParent)
End If
End If
Debug.Print vsoShapeParent.Name
End Function
Applies to | Addon object | Addons collection | Application object | ApplicationSettings object | Cell object | Characters object | Color object | Colors collection | Connect object | Connects collection | Curve object | Document object | Documents collection | Event object | EventList collection | Font object | Fonts collection | Hyperlink object | Hyperlinks collection | InvisibleApp object | KeyboardEvent object | Layer object | Layers collection | Master object | Masters collection | MasterShortcut object | MasterShortcuts collection | MouseEvent object | MSGWrap object | OLEObject object | OLEObjects collection | Page object | Pages collection | Path object | Paths collection | Row object | Section object | Selection object | Shape object | Shapes collection | Style object | Styles collection | Window object | Windows collection