Share via


Type Property [Visio 2003 SDK Documentation]

Returns the type of the object.

retVal = object**.Type**

retVal     Integer. The type of the Document, Page, Shape, or Window object.

object     Required. An expression that returns a Document, Page, Shape, or Window object.

Version added

2.0

Remarks

  • Type value constants for Document objects (the possible values that the Type property of a Document object returns) are declared by the Visio type library in VisDocumentTypes.

  • Type value constants for Page objects (the possible values that the Type property of a Page object returns) are declared by the Visio type library in VisPageTypes.

  • Type value constants for Shape objects (the possible values that the Type property of a Shape object returns) are declared by the Visio type library in VisShapeTypes.

    If a Shape object is type visTypeForeignObject, use the ForeignType property to determine the type of foreign object represented by the object.

  • Type value constants for Window objects (the possible values that the Type property of a Window object returns) are declared by the Visio type library in VisWinTypes.

    If a Window object is type visDrawing, use the SubType property to determine the type of drawing window represented by the object.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Type property to determine the type of a window.

Public Sub Type_Example()
 
    Dim vsoMaster As Visio.Master 
    Dim vsoShape As Visio.Shape 
    Dim vsoIconWindow As Visio.Window 
    Dim vsoShapeSheetWindow As Visio.Window
    Dim vsoStencilWindow As Visio.Window 

    'Draw a shape.
    Set vsoShape = ActivePage.DrawRectangle(1, 1, 2, 3) 

    'Open the document stencil window.
    Set vsoStencilWindow = ThisDocument.OpenStencilWindow

    'Open the ShapeSheet window of vsoShape.
    Set vsoShapeSheetWindow = vsoShape.OpenSheetWindow 

    'Add a master to the document stencil and open its icon editing window.
    Set vsoMaster = ThisDocument.Masters.Add 
    Set vsoIconWindow = vsoMaster.OpenIconWindow 

    'Use the Type property to verify each window's type.
    'This will print 7, 3, and 4 in the Immediate window to indicate 
    'a docked, built-in stencil window; a ShapeSheet window; and an 
    'icon editing window, respectively.
    Debug.Print vsoStencilWindow.Type 
    Debug.Print vsoShapeSheetWindow.Type 
    Debug.Print vsoIconWindow.Type 

End Sub

Applies to | Document object | Page object | Shape object | Window object

See Also | ForeignType property | SubType property