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 |
#11
|
|||
|
|||
Thank you Steve. It seems that I have one more hurdle to overcome.
It turns out that the shape isn't always "Rectangle 17" but can be other numbers. Therefore the line of code "Set oAgenda = oSld.Shapes("Rectangle 17").TextFrame.TextRange" may or may not be correct and it seems that I can't trap the error. I'm going to have to figure out how to discern how to reference the text frame and range. Sigh...... Jeff On Sun, 16 Jan 2005 14:01:21 EST, Steve Rindsberg wrote: In article , Jeff Jones wrote: LOL. I love to see people comrading..... The way Brian and I abuse one another, you'd think we're married. ;-) Sub ChangeHyperLinkData() Dim oSld As Slide Dim oAgenda As TextRange 'Stop ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Count Set oSld = ActivePresentation.Slides(ActivePresentation.Slide s.Count) You don't need to go to the slide (ie, to display it) in order to affect it, and in fact your code will run way faster if you don't. Set oSld = ActivePresentation.Slides(ActivePresentation.Slide s.Count) is enough ActiveWindow.Selection.SlideRange.Shapes("Rectangl e 17").Select ActiveWindow.Selection.ShapeRange.TextFrame.TextRa nge.Select With ActivePresentation.Slides(ActivePresentation.Slide s.Count) Set oAgenda = ActiveWindow.Selection.ShapeRange.TextFrame.TextRa nge End With Likewise, you don't need to select anything either. Just this will do it instead of all the above: Set oAgenda = oSld.Shapes("Rectangle 17").TextFrame.TextRange With oAgenda.Sentences(1) _ .ActionSettings(ppMouseClick).Hyperlink .Address = "http://www.gsms-am.eds.com/ http://www.gsms-am.eds.com/ " and so on ... It works fine as long as I open the blank.pot file that contains the macro. I've added a button to a new toolbar that executes the macro to the blank.pot file and it is available when I open PowerPoint but it's not effective until the blank.pot file itself has been opened. I'm playing with an add-in with the macro in it and can load the add-in with no problems but the button is still not effective until blank.pot is opened. Sigh..... Right. The button is associated with the macro in the original pot file in PPT's mind. Add an Auto_Open subroutine to the add-in and include code in it to create any necessary buttons/bars/menus. Create an ADD-IN with TOOLBARS that run macros http://www.rdpslides.com/pptfaq/FAQ00031.htm Where I want to end up is to have a macro that will open every presentation, in turn, in a folder, change the links on the last slide, and save the presentation. Do something to every file in a folder http://www.rdpslides.com/pptfaq/FAQ00536.htm Do you suppose that I'm sneaking up on my objective? I'm FAR too lazy to want to make all these changes manually. Besides, it's FAR, FAR more fun to build a macro to automate tedious tasks. Thank you all for your help thus far. My beloved is certain that I'm truly a computer geek and the fact that this wonderfulness if fun supports my geekness. giggle Jeff On Sat, 15 Jan 2005 11:49:42 EST, Steve Rindsberg wrote: In article , MS MVP Brian Reilly wrote: Jeff, Here's another piece of code in addition to Steve's that I use all the time as a wrapper to iterate through all shapes on all slides. Note, I've commented out the section that you can change exactly what you do, but the top and bottom parts are the iteration code. Brian reformats his hard drive quite often. Chances are he lost his mind the last time he did it. It's one of those pesky hidden files, ya know? Sub DiddleAllTheShapes() Dim oSh as Shape Dim oSl as Slide ' Look at each slide For Each oSl in ActivePresentation.Slides ' Look at each shape on the slide For each oSh in oSl.Shapes ' Do whatever you need to with the shape With oSh Debug.Print .Name .Left = .Left + 10 ' .Whatever End With ' The shape Next ' Shape Next ' Slide End Sub ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com =============================================== = ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com =============================================== = |
#12
|
|||
|
|||
In article , Jeff Jones wrote:
Thank you Steve. It seems that I have one more hurdle to overcome. It turns out that the shape isn't always "Rectangle 17" but can be other numbers. Therefore the line of code "Set oAgenda = oSld.Shapes("Rectangle 17").TextFrame.TextRange" may or may not be correct and it seems that I can't trap the error. I'm going to have to figure out how to discern how to reference the text frame and range. Sigh...... I figured we'd cross that bridge sooner or later. What's unique about this bit of text that you can key off of? Will it always be there and if so, will it always have some characteristic that distinguishes it from the other text on the slide? Or can you create it yourself as needed? Jeff On Sun, 16 Jan 2005 14:01:21 EST, Steve Rindsberg wrote: In article , Jeff Jones wrote: LOL. I love to see people comrading..... The way Brian and I abuse one another, you'd think we're married. ;-) Sub ChangeHyperLinkData() Dim oSld As Slide Dim oAgenda As TextRange 'Stop ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Count Set oSld = ActivePresentation.Slides(ActivePresentation.Slide s.Count) You don't need to go to the slide (ie, to display it) in order to affect it, and in fact your code will run way faster if you don't. Set oSld = ActivePresentation.Slides(ActivePresentation.Slide s.Count) is enough ActiveWindow.Selection.SlideRange.Shapes("Rectangl e 17").Select ActiveWindow.Selection.ShapeRange.TextFrame.TextRa nge.Select With ActivePresentation.Slides(ActivePresentation.Slide s.Count) Set oAgenda = ActiveWindow.Selection.ShapeRange.TextFrame.TextRa nge End With Likewise, you don't need to select anything either. Just this will do it instead of all the above: Set oAgenda = oSld.Shapes("Rectangle 17").TextFrame.TextRange With oAgenda.Sentences(1) _ .ActionSettings(ppMouseClick).Hyperlink .Address = "http://www.gsms-am.eds.com/ http://www.gsms-am.eds.com/ " and so on ... It works fine as long as I open the blank.pot file that contains the macro. I've added a button to a new toolbar that executes the macro to the blank.pot file and it is available when I open PowerPoint but it's not effective until the blank.pot file itself has been opened. I'm playing with an add-in with the macro in it and can load the add-in with no problems but the button is still not effective until blank.pot is opened. Sigh..... Right. The button is associated with the macro in the original pot file in PPT's mind. Add an Auto_Open subroutine to the add-in and include code in it to create any necessary buttons/bars/menus. Create an ADD-IN with TOOLBARS that run macros http://www.rdpslides.com/pptfaq/FAQ00031.htm Where I want to end up is to have a macro that will open every presentation, in turn, in a folder, change the links on the last slide, and save the presentation. Do something to every file in a folder http://www.rdpslides.com/pptfaq/FAQ00536.htm Do you suppose that I'm sneaking up on my objective? I'm FAR too lazy to want to make all these changes manually. Besides, it's FAR, FAR more fun to build a macro to automate tedious tasks. Thank you all for your help thus far. My beloved is certain that I'm truly a computer geek and the fact that this wonderfulness if fun supports my geekness. giggle Jeff On Sat, 15 Jan 2005 11:49:42 EST, Steve Rindsberg wrote: In article , MS MVP Brian Reilly wrote: Jeff, Here's another piece of code in addition to Steve's that I use all the time as a wrapper to iterate through all shapes on all slides. Note, I've commented out the section that you can change exactly what you do, but the top and bottom parts are the iteration code. Brian reformats his hard drive quite often. Chances are he lost his mind the last time he did it. It's one of those pesky hidden files, ya know? Sub DiddleAllTheShapes() Dim oSh as Shape Dim oSl as Slide ' Look at each slide For Each oSl in ActivePresentation.Slides ' Look at each shape on the slide For each oSh in oSl.Shapes ' Do whatever you need to with the shape With oSh Debug.Print .Name .Left = .Left + 10 ' .Whatever End With ' The shape Next ' Shape Next ' Slide End Sub ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com =============================================== = ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com =============================================== = ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ |
#13
|
|||
|
|||
I expected to find this bridge as well.
There are three lines of text and the initial characters in each line can uniquely identify each. One starts with Americas, another with Asia and the third with Europe. Each line will always be there and should always be on the last slide. I wandered through various code examples looking for a character string but couldn't figure out how to marry that code to the code to set a hypertext link. There's no reason why I can't create the TextFrame myself although, I'd need to drop the existing object before creating my own. Jeff On Sun, 16 Jan 2005 19:24:56 EST, Steve Rindsberg wrote: In article , Jeff Jones wrote: Thank you Steve. It seems that I have one more hurdle to overcome. It turns out that the shape isn't always "Rectangle 17" but can be other numbers. Therefore the line of code "Set oAgenda = oSld.Shapes("Rectangle 17").TextFrame.TextRange" may or may not be correct and it seems that I can't trap the error. I'm going to have to figure out how to discern how to reference the text frame and range. Sigh...... I figured we'd cross that bridge sooner or later. What's unique about this bit of text that you can key off of? Will it always be there and if so, will it always have some characteristic that distinguishes it from the other text on the slide? Or can you create it yourself as needed? Jeff On Sun, 16 Jan 2005 14:01:21 EST, Steve Rindsberg wrote: In article , Jeff Jones wrote: LOL. I love to see people comrading..... The way Brian and I abuse one another, you'd think we're married. ;-) Sub ChangeHyperLinkData() Dim oSld As Slide Dim oAgenda As TextRange 'Stop ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Count Set oSld = ActivePresentation.Slides(ActivePresentation.Slide s.Count) You don't need to go to the slide (ie, to display it) in order to affect it, and in fact your code will run way faster if you don't. Set oSld = ActivePresentation.Slides(ActivePresentation.Slide s.Count) is enough ActiveWindow.Selection.SlideRange.Shapes("Rectangl e 17").Select ActiveWindow.Selection.ShapeRange.TextFrame.TextRa nge.Select With ActivePresentation.Slides(ActivePresentation.Slide s.Count) Set oAgenda = ActiveWindow.Selection.ShapeRange.TextFrame.TextRa nge End With Likewise, you don't need to select anything either. Just this will do it instead of all the above: Set oAgenda = oSld.Shapes("Rectangle 17").TextFrame.TextRange With oAgenda.Sentences(1) _ .ActionSettings(ppMouseClick).Hyperlink .Address = "http://www.gsms-am.eds.com/ http://www.gsms-am.eds.com/ " and so on ... It works fine as long as I open the blank.pot file that contains the macro. I've added a button to a new toolbar that executes the macro to the blank.pot file and it is available when I open PowerPoint but it's not effective until the blank.pot file itself has been opened. I'm playing with an add-in with the macro in it and can load the add-in with no problems but the button is still not effective until blank.pot is opened. Sigh..... Right. The button is associated with the macro in the original pot file in PPT's mind. Add an Auto_Open subroutine to the add-in and include code in it to create any necessary buttons/bars/menus. Create an ADD-IN with TOOLBARS that run macros http://www.rdpslides.com/pptfaq/FAQ00031.htm Where I want to end up is to have a macro that will open every presentation, in turn, in a folder, change the links on the last slide, and save the presentation. Do something to every file in a folder http://www.rdpslides.com/pptfaq/FAQ00536.htm Do you suppose that I'm sneaking up on my objective? I'm FAR too lazy to want to make all these changes manually. Besides, it's FAR, FAR more fun to build a macro to automate tedious tasks. Thank you all for your help thus far. My beloved is certain that I'm truly a computer geek and the fact that this wonderfulness if fun supports my geekness. giggle Jeff On Sat, 15 Jan 2005 11:49:42 EST, Steve Rindsberg wrote: In article , MS MVP Brian Reilly wrote: Jeff, Here's another piece of code in addition to Steve's that I use all the time as a wrapper to iterate through all shapes on all slides. Note, I've commented out the section that you can change exactly what you do, but the top and bottom parts are the iteration code. Brian reformats his hard drive quite often. Chances are he lost his mind the last time he did it. It's one of those pesky hidden files, ya know? Sub DiddleAllTheShapes() Dim oSh as Shape Dim oSl as Slide ' Look at each slide For Each oSl in ActivePresentation.Slides ' Look at each shape on the slide For each oSh in oSl.Shapes ' Do whatever you need to with the shape With oSh Debug.Print .Name .Left = .Left + 10 ' .Whatever End With ' The shape Next ' Shape Next ' Slide End Sub ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com =============================================== = ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com =============================================== = ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com =============================================== = |
#14
|
|||
|
|||
In article , Jeff Jones wrote:
I expected to find this bridge as well. There are three lines of text and the initial characters in each line can uniquely identify each. One starts with Americas, another with Asia and the third with Europe. Each line will always be there and should always be on the last slide. I wandered through various code examples looking for a character string but couldn't figure out how to marry that code to the code to set a hypertext link. Hm. Something like this (off top of head, may require a bit of tweakage): Function WheresWaldosTextBox(oPresentation As Presentation) As Shape ' Returns the text box you need to work with Dim oSh As Shape ' Look at the last slide in the presentation's shapes For Each oSh In oPresentation.Slides(oPresentation.Slides.Count).S hapes If Mid$(oSh.TextFrame.TextRange.Paragraphs(1), 1, Len("America")) = "America" Then If Mid$(oSh.TextFrame.TextRange.Paragraphs(2), 1, Len("Japan")) = "Japan" Then If Mid$(oSh.TextFrame.TextRange.Paragraphs(3), 1, Len("Korea")) = "Korea" Then Set WheresWaldosTextBox = oSh Exit Function End If End If End If Next ' Shape End Function Sub testWaldo() MsgBox WheresWaldosTextBox(ActivePresentation).TextFrame. TextRange.Text End Sub There's no reason why I can't create the TextFrame myself although, I'd need to drop the existing object before creating my own. Jeff On Sun, 16 Jan 2005 19:24:56 EST, Steve Rindsberg wrote: In article , Jeff Jones wrote: Thank you Steve. It seems that I have one more hurdle to overcome. It turns out that the shape isn't always "Rectangle 17" but can be other numbers. Therefore the line of code "Set oAgenda = oSld.Shapes("Rectangle 17").TextFrame.TextRange" may or may not be correct and it seems that I can't trap the error. I'm going to have to figure out how to discern how to reference the text frame and range. Sigh...... I figured we'd cross that bridge sooner or later. What's unique about this bit of text that you can key off of? Will it always be there and if so, will it always have some characteristic that distinguishes it from the other text on the slide? Or can you create it yourself as needed? Jeff On Sun, 16 Jan 2005 14:01:21 EST, Steve Rindsberg wrote: In article , Jeff Jones wrote: LOL. I love to see people comrading..... The way Brian and I abuse one another, you'd think we're married. ;-) Sub ChangeHyperLinkData() Dim oSld As Slide Dim oAgenda As TextRange 'Stop ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Count Set oSld = ActivePresentation.Slides(ActivePresentation.Slide s.Count) You don't need to go to the slide (ie, to display it) in order to affect it, and in fact your code will run way faster if you don't. Set oSld = ActivePresentation.Slides(ActivePresentation.Slide s.Count) is enough ActiveWindow.Selection.SlideRange.Shapes("Rectangl e 17").Select ActiveWindow.Selection.ShapeRange.TextFrame.TextRa nge.Select With ActivePresentation.Slides(ActivePresentation.Slide s.Count) Set oAgenda = ActiveWindow.Selection.ShapeRange.TextFrame.TextRa nge End With Likewise, you don't need to select anything either. Just this will do it instead of all the above: Set oAgenda = oSld.Shapes("Rectangle 17").TextFrame.TextRange With oAgenda.Sentences(1) _ .ActionSettings(ppMouseClick).Hyperlink .Address = "http://www.gsms-am.eds.com/ http://www.gsms-am.eds.com/ " and so on ... It works fine as long as I open the blank.pot file that contains the macro. I've added a button to a new toolbar that executes the macro to the blank.pot file and it is available when I open PowerPoint but it's not effective until the blank.pot file itself has been opened. I'm playing with an add-in with the macro in it and can load the add-in with no problems but the button is still not effective until blank.pot is opened. Sigh..... Right. The button is associated with the macro in the original pot file in PPT's mind. Add an Auto_Open subroutine to the add-in and include code in it to create any necessary buttons/bars/menus. Create an ADD-IN with TOOLBARS that run macros http://www.rdpslides.com/pptfaq/FAQ00031.htm Where I want to end up is to have a macro that will open every presentation, in turn, in a folder, change the links on the last slide, and save the presentation. Do something to every file in a folder http://www.rdpslides.com/pptfaq/FAQ00536.htm Do you suppose that I'm sneaking up on my objective? I'm FAR too lazy to want to make all these changes manually. Besides, it's FAR, FAR more fun to build a macro to automate tedious tasks. Thank you all for your help thus far. My beloved is certain that I'm truly a computer geek and the fact that this wonderfulness if fun supports my geekness. giggle Jeff On Sat, 15 Jan 2005 11:49:42 EST, Steve Rindsberg wrote: In article , MS MVP Brian Reilly wrote: Jeff, Here's another piece of code in addition to Steve's that I use all the time as a wrapper to iterate through all shapes on all slides. Note, I've commented out the section that you can change exactly what you do, but the top and bottom parts are the iteration code. Brian reformats his hard drive quite often. Chances are he lost his mind the last time he did it. It's one of those pesky hidden files, ya know? Sub DiddleAllTheShapes() Dim oSh as Shape Dim oSl as Slide ' Look at each slide For Each oSl in ActivePresentation.Slides ' Look at each shape on the slide For each oSh in oSl.Shapes ' Do whatever you need to with the shape With oSh Debug.Print .Name .Left = .Left + 10 ' .Whatever End With ' The shape Next ' Shape Next ' Slide End Sub ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com =============================================== = ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com =============================================== = ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com =============================================== = ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ |
#15
|
|||
|
|||
Hi Steve,
Thank you for the snippet of code. I did get to tweak it a little and, for the most part, got it to work properly. Here's the code. Sub TestShapes() Dim numShapes, numAutoShapes, i As Long Dim oSld As Slide Dim oAgenda As TextRange Dim varTextFrame As Variant On Error GoTo HandleError 'Stop Set myDocument = ActivePresentation.Slides(ActivePresentation.Slide s.Count) With myDocument.Shapes numShapes = .Count If numShapes 1 Then numTextShapes = 0 For i = 1 To numShapes - 1 If .Item(i).HasTextFrame Then ' If .Item(i).HasText Then numTextShapes = numTextShapes + 1 varTextFrame = .Item(i).Name ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Count Set oSld = ActivePresentation.Slides(ActivePresentation.Slide s.Count) ActiveWindow.Selection.SlideRange.Shapes(varTextFr ame).Select Set oAgenda = oSld.Shapes(varTextFrame).TextFrame.TextRange If Mid$(oAgenda.Sentences(1), 1, Len("America")) = "America" Then ' Stop With oAgenda.Sentences(1) _ .ActionSettings(ppMouseClick).Hyperlink .Address = "http://www.gsms-am.eds.xxx/ http://www.gsms-am.eds.xxx/ " .TextToDisplay = "Americas: http://www.gsms-am.eds.xxx http://www.gsms-am.eds.xxx " & vbNewLine .SubAddress = "" End With With oAgenda.Sentences(2) _ .ActionSettings(ppMouseClick).Hyperlink .Address = "http://www.gsms-ap.eds.yyy/ http://www.gsms-ap.eds.yyy/ " .TextToDisplay = "Asia Pacific: http://www.gsms-ap.eds.yyy http://www.gsms-ap.eds.yyy " & vbNewLine .SubAddress = "" End With With oAgenda.Sentences(3) _ .ActionSettings(ppMouseClick).Hyperlink .Address = "http://www.gsms-ea.eds.zzz/ http://www.gsms-ea.eds.zzz/ " .TextToDisplay = "Europe & Africa: http://www.gsms-ea.eds.zzz http://www.gsms-ea.eds.zzz " .SubAddress = "" End With End If ' End If End If NextFor: Next End If End With Exit Sub HandleError: 'Stop If Err.Number = 9 Then GoTo NextFor ' Exit Sub End If Resume If Err.Number 0 Then Msg = "Error # " & Str(Err.Number) & " was generated by " _ & Err.Source & Chr(13) & Err.Description MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext End If End Sub The only rub is due to the fact that is seems that some people have a habit of leaving empty objects or shapes on slides rather than using or deleting them when adding a new slide. Th ecode worked correctly on 3 out of 4 presentations until I deleted the empty objects on the fourth. It then worked fine on all the test presentations. It seems that I'll be faced with some manual cleanup whether I like it or not. Oh well..... This is still easier that manually changing the links on every presentation. If you have anu suggesgions, I'd like to hear them. In the meantime, thank you VERY much for your help! Jeff On Mon, 17 Jan 2005 01:18:08 EST, Steve Rindsberg wrote: In article , Jeff Jones wrote: I expected to find this bridge as well. There are three lines of text and the initial characters in each line can uniquely identify each. One starts with Americas, another with Asia and the third with Europe. Each line will always be there and should always be on the last slide. I wandered through various code examples looking for a character string but couldn't figure out how to marry that code to the code to set a hypertext link. Hm. Something like this (off top of head, may require a bit of tweakage): Function WheresWaldosTextBox(oPresentation As Presentation) As Shape ' Returns the text box you need to work with Dim oSh As Shape ' Look at the last slide in the presentation's shapes For Each oSh In oPresentation.Slides(oPresentation.Slides.Count).S hapes If Mid$(oSh.TextFrame.TextRange.Paragraphs(1), 1, Len("America")) = "America" Then If Mid$(oSh.TextFrame.TextRange.Paragraphs(2), 1, Len("Japan")) = "Japan" Then If Mid$(oSh.TextFrame.TextRange.Paragraphs(3), 1, Len("Korea")) = "Korea" Then Set WheresWaldosTextBox = oSh Exit Function End If End If End If Next ' Shape End Function Sub testWaldo() MsgBox WheresWaldosTextBox(ActivePresentation).TextFrame. TextRange.Text End Sub There's no reason why I can't create the TextFrame myself although, I'd need to drop the existing object before creating my own. Jeff On Sun, 16 Jan 2005 19:24:56 EST, Steve Rindsberg wrote: |
#16
|
|||
|
|||
On Error GoTo HandleError
'Stop Set myDocument = ActivePresentation.Slides(ActivePresentation.Slide s.Count) Now suppose we sneak in right about here and do this: ' Delete any shapes that might hold text but don't and ' that are unfilled/unoutlined Dim X as Long Dim oSh as Shape For x = myDocument.Shapes.Count to 1 Step -1 Set oSh = myDocument.Shapes(x) ' Can the shape hold text? if oSh.HasTextFrame then ' Does it have text? if not osh.TextFrame.HasText Then ' Is it filled if not osh.fill.visible then ' does it have an outline? if not osh.line.visible then ' IT DIES osh.delete end if end if end if end if Next ' x With myDocument.Shapes numShapes = .Count If numShapes 1 Then numTextShapes = 0 For i = 1 To numShapes - 1 If .Item(i).HasTextFrame Then ' If .Item(i).HasText Then numTextShapes = numTextShapes + 1 varTextFrame = .Item(i).Name ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Count Set oSld = ActivePresentation.Slides(ActivePresentation.Slide s.Count) ActiveWindow.Selection.SlideRange.Shapes(varTextFr ame).Select Set oAgenda = oSld.Shapes(varTextFrame).TextFrame.TextRange If Mid$(oAgenda.Sentences(1), 1, Len("America")) = "America" Then ' Stop With oAgenda.Sentences(1) _ .ActionSettings(ppMouseClick).Hyperlink .Address = "http://www.gsms-am.eds.xxx/ http://www.gsms-am.eds.xxx/ " .TextToDisplay = "Americas: http://www.gsms-am.eds.xxx http://www.gsms-am.eds.xxx " & vbNewLine .SubAddress = "" End With With oAgenda.Sentences(2) _ .ActionSettings(ppMouseClick).Hyperlink .Address = "http://www.gsms-ap.eds.yyy/ http://www.gsms-ap.eds.yyy/ " .TextToDisplay = "Asia Pacific: http://www.gsms-ap.eds.yyy http://www.gsms-ap.eds.yyy " & vbNewLine .SubAddress = "" End With With oAgenda.Sentences(3) _ .ActionSettings(ppMouseClick).Hyperlink .Address = "http://www.gsms-ea.eds.zzz/ http://www.gsms-ea.eds.zzz/ " .TextToDisplay = "Europe & Africa: http://www.gsms-ea.eds.zzz http://www.gsms-ea.eds.zzz " .SubAddress = "" End With End If ' End If End If NextFor: Next End If End With Exit Sub HandleError: 'Stop If Err.Number = 9 Then GoTo NextFor ' Exit Sub End If Resume If Err.Number 0 Then Msg = "Error # " & Str(Err.Number) & " was generated by " _ & Err.Source & Chr(13) & Err.Description MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext End If End Sub The only rub is due to the fact that is seems that some people have a habit of leaving empty objects or shapes on slides rather than using or deleting them when adding a new slide. Th ecode worked correctly on 3 out of 4 presentations until I deleted the empty objects on the fourth. It then worked fine on all the test presentations. It seems that I'll be faced with some manual cleanup whether I like it or not. Oh well..... This is still easier that manually changing the links on every presentation. If you have anu suggesgions, I'd like to hear them. In the meantime, thank you VERY much for your help! Jeff On Mon, 17 Jan 2005 01:18:08 EST, Steve Rindsberg wrote: In article , Jeff Jones wrote: I expected to find this bridge as well. There are three lines of text and the initial characters in each line can uniquely identify each. One starts with Americas, another with Asia and the third with Europe. Each line will always be there and should always be on the last slide. I wandered through various code examples looking for a character string but couldn't figure out how to marry that code to the code to set a hypertext link. Hm. Something like this (off top of head, may require a bit of tweakage): Function WheresWaldosTextBox(oPresentation As Presentation) As Shape ' Returns the text box you need to work with Dim oSh As Shape ' Look at the last slide in the presentation's shapes For Each oSh In oPresentation.Slides(oPresentation.Slides.Count).S hapes If Mid$(oSh.TextFrame.TextRange.Paragraphs(1), 1, Len("America")) = "America" Then If Mid$(oSh.TextFrame.TextRange.Paragraphs(2), 1, Len("Japan")) = "Japan" Then If Mid$(oSh.TextFrame.TextRange.Paragraphs(3), 1, Len("Korea")) = "Korea" Then Set WheresWaldosTextBox = oSh Exit Function End If End If End If Next ' Shape End Function Sub testWaldo() MsgBox WheresWaldosTextBox(ActivePresentation).TextFrame. TextRange.Text End Sub There's no reason why I can't create the TextFrame myself although, I'd need to drop the existing object before creating my own. Jeff On Sun, 16 Jan 2005 19:24:56 EST, Steve Rindsberg wrote: ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ |
#17
|
|||
|
|||
Steve,
We certainly pay a price for PowerPoint flexibility. I lost power today and am way behind. I'll add this code into the code I have to get rid or empty text objects. I did run some more tests and have found that the code to spin through all presentations in a folder works just fine with my code. BTW, I have the go to and selection of the object in place to be able to debug the code. Once it's working properly, I'll not need those lines. Anyway, I end up with some errors on a few presentations. The error show up when I set the TextRange to the data in the TextFrame. My testing shows a valid name for the TextFrame. I have only 6 shapes on slide. When I record a macro and select each shape in turn, I get expected results. However, when I select the shape via the code I get the error. I tried replacing the 2 shapes with some from a slide that I knew was OK to no avail. I then tried replacing the entire slide. The last slide is the same on every presentation. The code didn't have the error with that slide. It appears that if I end up with this error, and I can't trap it since the error number is -2147024809, if I delete the slide and copy in a slide that is correct I'll have what I want. Pretty crazy. I can't categorically just add a new slide to the end of every presentation because some are children presentations to a master and don't need that final slide. Given the fact that I get the error before I can text the contents of the TextFrame to see if there is text and if the text starts with the Americas character string, I still need to run the code we've worked out. Ain't technology grand! I'm 99% closer to declaring victory that I would be without your help. Thank you. You're doing GREAT! Jeff On Mon, 17 Jan 2005 22:58:02 EST, Steve Rindsberg wrote: ' Delete any shapes that might hold text but don't and ' that are unfilled/unoutlined Dim X as Long Dim oSh as Shape For x = myDocument.Shapes.Count to 1 Step -1 Set oSh = myDocument.Shapes(x) ' Can the shape hold text? if oSh.HasTextFrame then ' Does it have text? if not osh.TextFrame.HasText Then ' Is it filled if not osh.fill.visible then ' does it have an outline? if not osh.line.visible then ' IT DIES osh.delete end if end if end if end if Next ' x |
#18
|
|||
|
|||
error show up when I set the TextRange to the data in the TextFrame.
My testing shows a valid name for the TextFrame. I have only 6 shapes on slide. When I record a macro and select each shape in turn, I get expected results. However, when I select the shape via the code I get the error. I tried replacing the 2 shapes with some from a slide that I knew was OK to no avail. I then tried replacing the entire slide. The last slide is the same on every presentation. The code didn't have the error with that slide. It appears that if I end up with this error, and I can't trap it since the error number is -2147024809, if I delete the slide and copy in a slide that is correct I'll have what I want. Pretty crazy. Sometimes slides or shapes on slides get corrupted; you might find that, impossible though it's supposed to be, there are two shapes with the same name on the slide. PowerPoint sometimes gets happyFingers just like us organic lifeforms! Wheeee. Try roundtripping the presentation to HTML as a test; if that fixes it, you probably had a corrupt shape on the slide. I can't categorically just add a new slide to the end of every presentation because some are children presentations to a master and don't need that final slide. Given the fact that I get the error before I can text the contents of the TextFrame to see if there is text and if the text starts with the Americas character string, I still need to run the code we've worked out. Ain't technology grand! I'm 99% closer to declaring victory that I would be without your help. Thank you. You're doing GREAT! blush Any time, Jeff. Keep those batteries charged up real good now, y'hear? ;-) Jeff On Mon, 17 Jan 2005 22:58:02 EST, Steve Rindsberg wrote: ' Delete any shapes that might hold text but don't and ' that are unfilled/unoutlined Dim X as Long Dim oSh as Shape For x = myDocument.Shapes.Count to 1 Step -1 Set oSh = myDocument.Shapes(x) ' Can the shape hold text? if oSh.HasTextFrame then ' Does it have text? if not osh.TextFrame.HasText Then ' Is it filled if not osh.fill.visible then ' does it have an outline? if not osh.line.visible then ' IT DIES osh.delete end if end if end if end if Next ' x ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ |
#19
|
|||
|
|||
I put together some code that deletes the last slide and copies the
only slide from my blank.pot file into the presentation I'm working on. That seems to solve the problem, at least until the next problem. giggle I'll try the HTML toggle to test the integrity of the slide. I have observed that we get unexpected features for some of microsoft apps and wouldn't be surprised that PowerPoint has its own. 'Course, I still use microsoft apps so I clearly am able to get around the features. I'll let you know what happens with the HTML toggle tomorrow morning. I have a healthy group of stuff to catch up on. Sigh...... The batteries are charging as my phabulous phlying phlanges dance over the keys...... Take care, Jeff On Tue, 18 Jan 2005 17:17:30 EST, Steve Rindsberg wrote: error show up when I set the TextRange to the data in the TextFrame. My testing shows a valid name for the TextFrame. I have only 6 shapes on slide. When I record a macro and select each shape in turn, I get expected results. However, when I select the shape via the code I get the error. I tried replacing the 2 shapes with some from a slide that I knew was OK to no avail. I then tried replacing the entire slide. The last slide is the same on every presentation. The code didn't have the error with that slide. It appears that if I end up with this error, and I can't trap it since the error number is -2147024809, if I delete the slide and copy in a slide that is correct I'll have what I want. Pretty crazy. Sometimes slides or shapes on slides get corrupted; you might find that, impossible though it's supposed to be, there are two shapes with the same name on the slide. PowerPoint sometimes gets happyFingers just like us organic lifeforms! Wheeee. Try roundtripping the presentation to HTML as a test; if that fixes it, you probably had a corrupt shape on the slide. I can't categorically just add a new slide to the end of every presentation because some are children presentations to a master and don't need that final slide. Given the fact that I get the error before I can text the contents of the TextFrame to see if there is text and if the text starts with the Americas character string, I still need to run the code we've worked out. Ain't technology grand! I'm 99% closer to declaring victory that I would be without your help. Thank you. You're doing GREAT! blush Any time, Jeff. Keep those batteries charged up real good now, y'hear? ;-) Jeff On Mon, 17 Jan 2005 22:58:02 EST, Steve Rindsberg wrote: ' Delete any shapes that might hold text but don't and ' that are unfilled/unoutlined Dim X as Long Dim oSh as Shape For x = myDocument.Shapes.Count to 1 Step -1 Set oSh = myDocument.Shapes(x) ' Can the shape hold text? if oSh.HasTextFrame then ' Does it have text? if not osh.TextFrame.HasText Then ' Is it filled if not osh.fill.visible then ' does it have an outline? if not osh.line.visible then ' IT DIES osh.delete end if end if end if end if Next ' x ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com =============================================== = |
#20
|
|||
|
|||
In article , Jeff Jones wrote:
I put together some code that deletes the last slide and copies the only slide from my blank.pot file into the presentation I'm working on. That seems to solve the problem, at least until the next problem. giggle I'll try the HTML toggle to test the integrity of the slide. I have observed that we get unexpected features for some of microsoft apps Aw shoot. Push any app from anybody hard and you'll get unexpected features. ;-) and wouldn't be surprised that PowerPoint has its own. Not PowerPoint, naw, nope nuh-uh, never. ROFL! I'll let you know what happens with the HTML toggle tomorrow morning. I have a healthy group of stuff to catch up on. Sigh...... The batteries are charging as my phabulous phlying phlanges dance over the keys...... Take care, Jeff On Tue, 18 Jan 2005 17:17:30 EST, Steve Rindsberg wrote: error show up when I set the TextRange to the data in the TextFrame. My testing shows a valid name for the TextFrame. I have only 6 shapes on slide. When I record a macro and select each shape in turn, I get expected results. However, when I select the shape via the code I get the error. I tried replacing the 2 shapes with some from a slide that I knew was OK to no avail. I then tried replacing the entire slide. The last slide is the same on every presentation. The code didn't have the error with that slide. It appears that if I end up with this error, and I can't trap it since the error number is -2147024809, if I delete the slide and copy in a slide that is correct I'll have what I want. Pretty crazy. Sometimes slides or shapes on slides get corrupted; you might find that, impossible though it's supposed to be, there are two shapes with the same name on the slide. PowerPoint sometimes gets happyFingers just like us organic lifeforms! Wheeee. Try roundtripping the presentation to HTML as a test; if that fixes it, you probably had a corrupt shape on the slide. I can't categorically just add a new slide to the end of every presentation because some are children presentations to a master and don't need that final slide. Given the fact that I get the error before I can text the contents of the TextFrame to see if there is text and if the text starts with the Americas character string, I still need to run the code we've worked out. Ain't technology grand! I'm 99% closer to declaring victory that I would be without your help. Thank you. You're doing GREAT! blush Any time, Jeff. Keep those batteries charged up real good now, y'hear? ;-) Jeff On Mon, 17 Jan 2005 22:58:02 EST, Steve Rindsberg wrote: ' Delete any shapes that might hold text but don't and ' that are unfilled/unoutlined Dim X as Long Dim oSh as Shape For x = myDocument.Shapes.Count to 1 Step -1 Set oSh = myDocument.Shapes(x) ' Can the shape hold text? if oSh.HasTextFrame then ' Does it have text? if not osh.TextFrame.HasText Then ' Is it filled if not osh.fill.visible then ' does it have an outline? if not osh.line.visible then ' IT DIES osh.delete end if end if end if end if Next ' x ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com =============================================== = ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ |
Thread Tools | |
Display Modes | |
|
|