【问题标题】:Where is Actionsettings in TextRange2?TextRange2 中的操作设置在哪里?
【发布时间】:2011-03-08 19:25:17
【问题描述】:

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

但是,我的代码很长,使用了TextFrame2 及其对应的TextRange2,我在TextRange2 中找不到ActionSettings

有谁知道它藏在哪里?

【问题讨论】:

    标签: vba hyperlink powerpoint


    【解决方案1】:

    是的,这有点棘手。以下是获取所有这些的方法:

    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
    

    【讨论】:

    • 谢谢,但我特别询问了 TextFrame2 和 TextRange2。
    • @Arie: ActionSettings 不存在 TextRange2 - 您没有查阅帮助文件吗?使用TextFrame2 的原因只有两个 - 1) 您正在使用活动的选定对象,以及 2) 您希望访问 PowerPoint 2007/2010 功能。听起来不像#2,所以它一定是#1。在这种情况下,TextFrame 也可以用于Selection 对象,甚至与TextFrame2 并排使用。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-04-02
    • 2020-03-07
    • 2016-12-25
    • 1970-01-01
    • 2019-01-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多