Macro Error Message - How can I fix?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a macro in PPT but every time I try to run it I get an error: "Run
time error '424'" Does anyone know what the problem might be? Here is the
Macro I am using:

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

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 an astute user on the PPT Newsgroup, lets fix OLE
links too
For Each oS In oSl.Shapes
If oSh.Type = msoLinkedOLEObject Then
oS.LinkFormat.SourceFullName = _
Replace(oShape.LinkFormat.SourceFullName, _
sSearchFor, sReplaceWith)
End If
Next

Next ' slide

End Sub


Any help is appreciated. thank you!
 
Teresa,

Keep the discussions of this in one thread. Are you now getting more
errors as this is different than the other you got before. I see you
didn't fix the problems from the other thread in what you've put in this
thread.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
David, Sorry about the thread thing. I am new to this and wasn't sure if you
would see my reply. I did fix the "h" problem in the code but am now getting
a new error message where it says "Run time error '424' Object required" and
it highlights this portion of the code:

oSh.LinkFormat.SourceFullName = _
Replace(oShape.LinkFormat.SourceFullName, _
sSearchFor, sReplaceWith)

Thanks again for all your help!
 
Back
Top