HasDiagramNode Property

Microsoft Word Visual Basic

MsoTriState can be one of these MsoTriState constants.
msoCTrue Not used for this property.
msoFalse Returned if a shape is not a diagram node.
msoTriStateMixed Not used for this property.
msoTriStateToggle Not used for this property.
msoTrue Returned if a shape is a diagram node.

expression.HasDiagramNode

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

This example searches the current document for diagrams with nodes and, if it finds both, creates a black balloon with bold white text.

Sub HasDiagramProperties()
    Dim shpDiagram As Shape
    Dim shpNode As DiagramNode
    Dim shpBalloon As Shape
    Dim docThis As Document

    Set docThis = ThisDocument

    'Looks through the current document and when it finds a diagram
    ' with one or more diagram nodes, creates a balloon with text
    For Each shpDiagram In docThis.Shapes
        If shpDiagram.HasDiagram = msoTrue _
            And shpDiagram.HasDiagramNode = msoTrue Then
                Set shpBalloon = docThis.Shapes.AddShape( _
                    Type:=msoShapeBalloon, Left:=350, _
                    Top:=75, Width:=150, Height:=150)
                With shpBalloon
                    With .TextFrame.TextRange
                        .Text = "This is a diagram with nodes."
                        .Font.Color = wdColorWhite
                        .Font.Bold = True
                        .Font.Name = "Tahoma"
                        .Font.Size = 15
                    End With
                    .Line.BackColor.RGB = RGB( _
                        Red:=0, Green:=25, Blue:=25)
                    .Fill.ForeColor.RGB = RGB( _
                        Red:=0, Green:=25, Blue:=25)
                End With
        End If
    Next shpDiagram
End Sub