Layout Property

Microsoft Word Visual Basic

Show All

Layout Property

       

Returns or sets an MsoOrgChartLayoutType constant to indicate the formatting of the child nodes in an organization chart. Read/write.

MsoOrgChartLayoutType can be one of these MsoOrgChartLayoutType constants.
msoOrgChartLayoutAssistant  Places child nodes as assistants.
msoOrgChartLayoutBothHanging  Places child nodes vertically below the parent node on both the left and the right side.
msoOrgChartLayoutLeftHanging  Places child nodes vertically below the parent node on the left side.
msoOrgChartLayoutMixed  Return value for a parent node that has children formatted using more than one MsoOrgChartLayoutType.
msoOrgChartLayoutRightHanging  Places child nodes vertically below the parent node on the right side.
msoOrgChartLayoutStandard  Places child nodes horizontally below the parent node.

expression.Layout

expression   Required. An expression that returns a DiagramNode object.

Example

This example creates an organization chart in the active document with three child nodes and places them vertically beneath the parent node along the right side.

Sub OrgChartLayoutHangRight()
    Dim shpOrgChart As Shape
    Dim dgnRoot As DiagramNode
    Dim dgnManagerShape As DiagramNode
    Dim intCount As Integer

    'Add an org chart to the active document and
    'add the first (parent) node
    Set shpOrgChart = ActiveDocument.Shapes.AddDiagram( _
        Type:=msoDiagramOrgChart, Left:=10, _
        Top:=15, Width:=400, Height:=475)
    Set dgnRoot = shpOrgChart.DiagramNode.Children.AddNode

    'Add three child nodes to the parent node
    For intCount = 1 To 3
        dgnRoot.Children.AddNode
    Next

    'Format the child nodes to hang vertically along the
    'right directly under the parent node.
    dgnRoot.Layout = msoOrgChartLayoutRightHanging
End Sub