Position Property [Visio 2003 SDK Documentation]

Gets or sets the position of an object.

intRet = object**.Position**

object**.Position** = intExpression

intRet     Integer. The object's position.

object     Required. An expression that returns a MenuSet or Toolbar object.

intExpression     Required Integer. The object's new position.

Version added

2000

Remarks

Constants that represent possible Position property values are listed below. They are also declared by the Visio type library in VisUIBarPosition.

Constant Value

visBarLeft

0

visBarTop

1

visBarRight

2

visBarBottom

3

visBarFloating

4

visBarPopup

5

visBarMenu

6

Example

This example shows how to use the Position property to set the position of a custom toolbar. The example adds a custom toolbar to the Toolbars collection. The toolbar appears in the Visio user interface and is available while the document is active.

To restore the built-in toolbars in Microsoft Office Visio after you run this macro, call the ThisDocument.ClearCustomToolbars method.

Sub Position_Example()
 
    Dim vsoUIObject As Visio.UIObject 
    Dim vsoToolbars As Visio.Toolbars 
    Dim vsoToolbar As Visio.Toolbar
 
    'Check whether there are document custom toolbars. 
    If ThisDocument.CustomToolbars Is Nothing Then

        'Check whether there are application custom toolbars. 
        If Visio.Application.CustomToolbars Is Nothing Then

            'Use the built-in toolbars. 
            Set vsoUIObject = Visio.Application.BuiltInToolbars(0) 

        Else

            'Use the application custom toolbars. 
            Set vsoUIObject = Visio.Application.CustomToolbars.Clone 

        End If  

    Else

        'Use the document custom toolbars. 
        Set vsoUIObject = ThisDocument.CustomToolbars 

    End If  

    'Get the Toolbars collection for the drawing window context. 
    Set vsoToolbars = vsoUIObject.ToolbarSets.ItemAtID( _ 
        Visio.visUIObjSetDrawing).Toolbars 

    'Add a toolbar to the collection. 
    Set vsoToolbar = vsoToolbars.Add 
    With vsoToolbar 

        'Set the title of the toolbar. 
        .Caption = "Test" 

        'Float the toolbar at coordinates (300,200). 
        .Position = Visio.visBarFloating 
        .Left = 300 
        .Top = 200 

        'Disallow docking the new toolbar. 
        .Protection = Visio.visBarNoHorizontalDock _ 
            + Visio.visBarNoVerticalDock 

    End With  

    'Use the new UIObject object while 
    'this document is active. 
    ThisDocument.SetCustomToolbars vsoUIObject 

End Sub

Applies to | MenuSet object | Toolbar object

See Also | Height property | Left property | Width property