TPE

http://bayanbox.ir/view/263405954590585756/2mobile.png

Tavvafi@gmail.com


≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

این ماکرو از شما سئوالی می پرسد که می خواهید به دنبال چه متنی بگردید، برای جایگزینی، و سپس این جایگزینی را در لینک اجام می دهد.

Option Explicit

Sub HyperLinkSearchReplace()

    Dim oSl As Slide
    Dim oHl As Hyperlink
    Dim sSearchFor As String
    Dim sReplaceWith As String
    Dim oSh As Shape

    sSearchFor = InputBox("What text should I search for?", "Search for ...")
    If sSearchFor = "" Then
        Exit Sub
    End If

    sReplaceWith = InputBox("What text should I replace" & vbCrLf _
        & sSearchFor & vbCrLf _
        & "with?", "Replace with ...")
    If sReplaceWith = "" Then
        Exit Sub
    End If

    On Error Resume Next

    For Each oSl In ActivePresentation.Slides

        For Each oHl In oSl.Hyperlinks
            oHl.Address = Replace(oHl.Address, sSearchFor, sReplaceWith)
            oHl.SubAddress = Replace(oHl.SubAddress, sSearchFor, sReplaceWith)
        Next    ' hyperlink

        ' and thanks to several astute user suggestions, let's fix OLE links 
        ' and movie/sound linkes too
        For Each oSh In oSl.Shapes
           If oSh.Type = msoLinkedOLEObject _
            Or oSh.Type = msoMedia Then
              oSh.LinkFormat.SourceFullName = _
                   Replace(oSh.LinkFormat.SourceFullName, _
                   sSearchFor, sReplaceWith)
           End If
       Next

    Next    ' slide

End Sub

And another trick ...

At least some versions of PowerPoint permit you to link to files on the internet. It's more convenient to create the links from files on your local PC, though. So you create the links locally, upload the linked files to the web server, then use the macro above to replace the local file path with the server path.

For example, suppose you have links to
C:\MyFiles\Spreadsheets\TEST.XLSX!Sheet1!R1C1:R5C5

You copy TEXT.XLSX to

http://www.yourdomain.xyz/myfiles/spreadsheets/

Now you can update the links by running the code above and asking it to replace:

C:\MyFiles\Spreadsheets\

with

http://www.yourdomain.xyz/myfiles/spreadsheets/

Your link now points to:

http://www.yourdomain.xyz/myfiles/spreadsheets/TEST.XLSX!Sheet1!R1C1:R5C5

And updates when you open your PPT file.