A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Powerpoint, Publisher and Visio » Powerpoint
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro Error Message - How do I fix?



 
 
Thread Tools Display Modes
  #1  
Old March 5th, 2007, 03:56 PM posted to microsoft.public.powerpoint
Teresa![_2_]
external usenet poster
 
Posts: 18
Default Macro Error Message - How do I fix?

I am running a Macro in PPT but I get a message each time I try to run the
Macro that says "Run time error '91' Object Variable or With Block Variable
not set. Here is the code I used: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 would be greatly appreciated.
  #2  
Old March 5th, 2007, 04:13 PM posted to microsoft.public.powerpoint
David M. Marcovitz
external usenet poster
 
Posts: 1,267
Default Macro Error Message - How do I fix?

Your missing an h on this line:

For Each oS In oSl.Shapes

It should be For Each oSh ...

--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/

=?Utf-8?B?VGVyZXNhIQ==?= wrote in
:

I am running a Macro in PPT but I get a message each time I try to run
the Macro that says "Run time error '91' Object Variable or With Block
Variable not set. Here is the code I used: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 would be greatly appreciated.


  #3  
Old March 5th, 2007, 05:06 PM posted to microsoft.public.powerpoint
Teresa![_2_]
external usenet poster
 
Posts: 18
Default Macro Error Message - How do I fix?

Thank you, David. I made the change and now it's telling me "Object
Required". what does that mean and how can I fix it?



"David M. Marcovitz" wrote:

Your missing an h on this line:

For Each oS In oSl.Shapes

It should be For Each oSh ...

--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/

=?Utf-8?B?VGVyZXNhIQ==?= wrote in
:

I am running a Macro in PPT but I get a message each time I try to run
the Macro that says "Run time error '91' Object Variable or With Block
Variable not set. Here is the code I used: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 would be greatly appreciated.



  #4  
Old March 5th, 2007, 05:33 PM posted to microsoft.public.powerpoint
David M. Marcovitz
external usenet poster
 
Posts: 1,267
Default Macro Error Message - How do I fix?

Two lines down, another oS should be oSh.
--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/

=?Utf-8?B?VGVyZXNhIQ==?= wrote in
:

Thank you, David. I made the change and now it's telling me "Object
Required". what does that mean and how can I fix it?



"David M. Marcovitz" wrote:

Your missing an h on this line:

For Each oS In oSl.Shapes

It should be For Each oSh ...

--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/

=?Utf-8?B?VGVyZXNhIQ==?= wrote in
:

I am running a Macro in PPT but I get a message each time I try to

run
the Macro that says "Run time error '91' Object Variable or With

Block
Variable not set. Here is the code I used: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 would be greatly appreciated.




  #5  
Old March 5th, 2007, 05:37 PM posted to microsoft.public.powerpoint
David M. Marcovitz
external usenet poster
 
Posts: 1,267
Default Macro Error Message - How do I fix?

One more thing. When you get a runtime error, hit the Debug button and it
should highlight the line that is causing the error. This should help you
track down any problems.
--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/

=?Utf-8?B?VGVyZXNhIQ==?= wrote in
:

Thank you, David. I made the change and now it's telling me "Object
Required". what does that mean and how can I fix it?



"David M. Marcovitz" wrote:

Your missing an h on this line:

For Each oS In oSl.Shapes

It should be For Each oSh ...

--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/

=?Utf-8?B?VGVyZXNhIQ==?= wrote in
:

I am running a Macro in PPT but I get a message each time I try to

run
the Macro that says "Run time error '91' Object Variable or With

Block
Variable not set. Here is the code I used: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 would be greatly appreciated.




  #6  
Old March 5th, 2007, 06:02 PM posted to microsoft.public.powerpoint
Teresa![_2_]
external usenet poster
 
Posts: 18
Default Macro Error Message - How do I fix?

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 both places 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!


"David M. Marcovitz" wrote:

One more thing. When you get a runtime error, hit the Debug button and it
should highlight the line that is causing the error. This should help you
track down any problems.
--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/

=?Utf-8?B?VGVyZXNhIQ==?= wrote in
:

Thank you, David. I made the change and now it's telling me "Object
Required". what does that mean and how can I fix it?



"David M. Marcovitz" wrote:

Your missing an h on this line:

For Each oS In oSl.Shapes

It should be For Each oSh ...

--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/

=?Utf-8?B?VGVyZXNhIQ==?= wrote in
:

I am running a Macro in PPT but I get a message each time I try to

run
the Macro that says "Run time error '91' Object Variable or With

Block
Variable not set. Here is the code I used: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 would be greatly appreciated.





  #7  
Old March 5th, 2007, 06:14 PM posted to microsoft.public.powerpoint
David M. Marcovitz
external usenet poster
 
Posts: 1,267
Default Macro Error Message - How do I fix?

This time instead of oS, you have used oShape. But the error is the same.
It should be oSh.
--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/

=?Utf-8?B?VGVyZXNhIQ==?= wrote in
:

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 both places 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!


"David M. Marcovitz" wrote:

One more thing. When you get a runtime error, hit the Debug button
and it should highlight the line that is causing the error. This
should help you track down any problems.
--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/

=?Utf-8?B?VGVyZXNhIQ==?= wrote in
:

Thank you, David. I made the change and now it's telling me "Object
Required". what does that mean and how can I fix it?



"David M. Marcovitz" wrote:

Your missing an h on this line:

For Each oS In oSl.Shapes

It should be For Each oSh ...

--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/

=?Utf-8?B?VGVyZXNhIQ==?= wrote
in :

I am running a Macro in PPT but I get a message each time I try
to

run
the Macro that says "Run time error '91' Object Variable or With

Block
Variable not set. Here is the code I used: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 would be greatly appreciated.







  #8  
Old March 5th, 2007, 06:32 PM posted to microsoft.public.powerpoint
Teresa![_2_]
external usenet poster
 
Posts: 18
Default Macro Error Message - How do I fix?

It Works! You're a genius, David! You've saved me a lot of valuable time. I
really appreciate it!

-Teresa



"David M. Marcovitz" wrote:

This time instead of oS, you have used oShape. But the error is the same.
It should be oSh.
--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/

=?Utf-8?B?VGVyZXNhIQ==?= wrote in
:

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 both places 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!


"David M. Marcovitz" wrote:

One more thing. When you get a runtime error, hit the Debug button
and it should highlight the line that is causing the error. This
should help you track down any problems.
--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/

=?Utf-8?B?VGVyZXNhIQ==?= wrote in
:

Thank you, David. I made the change and now it's telling me "Object
Required". what does that mean and how can I fix it?



"David M. Marcovitz" wrote:

Your missing an h on this line:

For Each oS In oSl.Shapes

It should be For Each oSh ...

--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/

=?Utf-8?B?VGVyZXNhIQ==?= wrote
in :

I am running a Macro in PPT but I get a message each time I try
to
run
the Macro that says "Run time error '91' Object Variable or With
Block
Variable not set. Here is the code I used: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 would be greatly appreciated.








  #9  
Old March 5th, 2007, 07:20 PM posted to microsoft.public.powerpoint
David M. Marcovitz
external usenet poster
 
Posts: 1,267
Default Macro Error Message - How do I fix?

Glad I could help. Wait until you have some really difficult questions
before you start calling me a genius.
--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/

=?Utf-8?B?VGVyZXNhIQ==?= wrote in
:

It Works! You're a genius, David! You've saved me a lot of valuable
time. I really appreciate it!

-Teresa



"David M. Marcovitz" wrote:

This time instead of oS, you have used oShape. But the error is the
same. It should be oSh.
--David

  #10  
Old March 5th, 2007, 08:52 PM posted to microsoft.public.powerpoint
Teresa![_2_]
external usenet poster
 
Posts: 18
Default Macro Error Message - How do I fix?

OK, here's a really hard question (maybe) how can I link the title of each
slide to update with the excel document. For example, let's say my title is
Project Falcon and this title appears in the excel sheet. Is there a way to
link the title of each slide with the title in excel? let's say slide 1 would
read "Project Falcon - Company Overview" Can we rig it to just update the
"Project Falcon" portion?



"David M. Marcovitz" wrote:

Glad I could help. Wait until you have some really difficult questions
before you start calling me a genius.
--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/

=?Utf-8?B?VGVyZXNhIQ==?= wrote in
:

It Works! You're a genius, David! You've saved me a lot of valuable
time. I really appreciate it!

-Teresa



"David M. Marcovitz" wrote:

This time instead of oS, you have used oShape. But the error is the
same. It should be oSh.
--David


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:59 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.