TextRange2中的Actionsettings在哪里?

时间:2010-06-27 10:08:01

标签: vba hyperlink powerpoint powerpoint-vba

我需要从PowerPoint 2007中的文本运行中提取超链接。我知道我可以这样做: TextFrame.TextRange.ActionSettings[PpMouseActivation.ppMouseClick].Hyperlink

但是,我的代码非常冗长,使用了TextFrame2及其相应的TextRange2,我在ActionSettings中找不到TextRange2

有谁知道它隐藏在哪里?

1 个答案:

答案 0 :(得分:0)

是的,这有点棘手。以下是如何获得所有这些内容:

Sub GetLinks()
    Dim p As Presentation
    Set p = ActivePresentation
    Dim s As Slide
    Dim sh As Shape
    For Each s In p.Slides
        For Each sh In s.Shapes
            Dim tr As TextRange
            Set tr = sh.TextFrame.TextRange
            For I = 1 To tr.Runs.count
                link = tr.Runs(I).ActionSettings(ppMouseClick).Hyperlink.Address
                If Len(link) > 0 Then
                    Debug.Print "Link: " & link
                End If
            Next
        Next
    Next
End Sub