Results 1 to 8 of 8

Thread: Solved: Hyperlink TEXT not TextFrame, PPT help!!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    VBAX Newbie
    Joined
    Oct 2006
    Posts
    5
    Location

    RE:

    Tom/All,

    Yes I meant to remember to mention that. You need to add MS VBscript Regular Expressions v5.5 as a reference (and possibly download Windows Script 5.6, see msdn.microsoft.com/library/default.asp?url=/downloads/list/webdev.asp) if you want to see this run. If you want to see it work, you need to also type a number in the form of [1-3] alphas + [6] digits, i.e. j765890 into the presentation. To make it easy, here's the whole, complete function with declarations. It works with both versions of PPT (2000 & 2003) so far as I can tell.

    Thanks very much,
    Tim

    [vba]

    Sub timsfunction()

    Dim re, m As Match
    Dim Anchor As Object
    Dim URL As String
    Dim stopIndex As String
    URL1 = "first part of my url"
    URL2 = "second part of my url"
    Set re = New RegExp
    re.Pattern = "\w{1,3}\d{6}"
    re.Global = True

    For Each sld In Application.ActivePresentation.Slides
    For Each shp In sld.Shapes
    If shp.HasTextFrame Then
    Set txtRng = shp.TextFrame.TextRange
    For Each m In re.Execute(txtRng)
    fullURL = URL1 + m.Value + URL2
    stopIndex = m.FirstIndex + m.Length
    With shp.TextFrame.TextRange.Characters(m.FirstIndex, stopIndex)
    'MsgBox (m.FirstIndex) 'use to verify indices are correct
    'MsgBox (stopIndex)
    With .ActionSettings(ppMouseClick)
    .Action = ppActionHyperlink
    .Hyperlink.TextToDisplay = m.Value
    .Hyperlink.Address = fullURL
    End With
    End With
    Next
    End If
    Next
    Next

    End Sub
    [/vba]
    Last edited by Tim@SU; 11-13-2006 at 07:30 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •