HasDiagramNode Property

HasDiagramNode Property

Office 2003

MsoTriState can be one of these MsoTriState constants.
msoCTrue Doesn't apply to this property.
msoFalse Shape is not a diagram node.
msoTriStateMixed Doesn't apply to this property.
msoTriStateToggle Doesn't apply to this property.
msoTrue Shape is a diagram node.


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


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 sldFirst As Slide

    Set sldFirst = ActivePresentation.Slides(1)

    '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 sldFirst.Shapes
        If shpDiagram.HasDiagram = msoTrue And _
            shpDiagram.HasDiagramNode = msoTrue Then
                Set shpBalloon = sldFirst.Shapes.AddShape( _
                    Type:=msoShapeBalloon, Left:=350, _
                    Top:=75, Width:=150, Height:=150)
                With shpBalloon
                    With .TextFrame
                        .WordWrap = msoTrue
                        With .TextRange
                            .Text = "This is a diagram with nodes."
                            .Font.Color.RGB = RGB(Red:=255, _
                                Green:=255, Blue:=255)
                            .Font.Bold = True
                            .Font.Name = "Tahoma"
                            .Font.Size = 15
                        End With
                    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

© 2015 Microsoft