HasDiagramNode Property
Returns whether a diagram node exists in a given shape or shape range. Read-only MsoTriState.
MsoTriState can be one of these MsoTriState constants. |
msoCTrue Not used for this property. |
msoFalse Returns if a shape is not a diagram node. |
msoTriStateMixed Not used for this property. |
msoTriStateToggle Not used for this property. |
msoTrue Returns 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
The following example places a diagram node in the active worksheet and then displays a message as to whether or not the node was successfully created.
Sub IsDiagram()
Dim shDiagram As Shape
Dim nodItem As DiagramNode
Set shDiagram = ActiveSheet.Shapes.AddDiagram( _
Type:=msoDiagramOrgChart, Top:=10, _
Left:=15, Width:=400, Height:=475)
Set nodItem = shDiagram.DiagramNode
'Add a root node to the diagram.
nodItem.Children.AddNode
' Notify user about diagram.
If shDiagram.HasDiagramNode = msoTrue Then
MsgBox "Diagram node present"
Else
MsgBox "No diagram node present"
End If
End Sub