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. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|