全部显示

HasDiagram 属性

       

如果形状是图示,则使用 MsoTrue 属性值。只读。MsoTriState 类型。

expression.HasDiagram

expression  必选。该表达式返回“应用于”列表中的对象之一。

示例

本示例搜索当前文档查找带有节点的图示,如果发现了带有节点的图示,则创建一个带有白色粗体文字的黑色气球。

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