2010-06-27 50 views
0

我需要提取超鏈接文本從在PowerPoint 2007中運行,我知道我能做到這樣使用: TextFrame.TextRange.ActionSettings[PpMouseActivation.ppMouseClick].HyperlinkTextRange2中的Actionsettings在哪裏?

然而,我的代碼,這是相當漫長的,使用TextFrame2及其相應TextRange2,我找不到。

有誰知道它藏在哪裏?

回答

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 
+0

謝謝,但我特別詢問了TextFrame2和TextRange2。 – 2010-06-28 10:42:06

+0

@Arie:'TextRange2'不存在'ActionSettings' - 你沒有查閱幫助文件嗎?使用'TextFrame2'只有兩個原因 - 1)您正在使用活動的選定對象,以及2)您想要訪問PowerPoint 2007/2010功能。它聽起來不像#2,所以它必須是#1。在這種情況下,'TextFrame'也可以用於'Selection'對象,甚至可以與'TextFrame2'並排使用。 – 2010-06-28 15:21:47