Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PowerPoint VBA to Change TextFrame Data

Status
Not open for further replies.

jpjones23

Programmer
Jan 6, 2005
7
US
I have 150+ presentations, each with three hypertext links in a
TextFrame object. I need to modify each of these links. I have a
couple of VBA wonderings.

First, with MS Word I have the normal.dot file and with MS Excel I
have the personal.xls file. Both hold macros or VBA code that can be
executed against any document or spreadsheet. Thus far and as near as
I can tell, PowerPoint doesn't have a counterpart generic template
that will retain macros that may be executed against any presentation.
Is this true?

Second, I've had no problem in the past writing macros that open every
document or spreadsheet, in turn, in a folder. Once open, I can make
changes, save the changes and close and open the next asset.
PowerPoint seems to be so freeform that even if I had a generic
template, there doesn't seem to be any way that I can select a single
TextFrame on the last slide, change the three links and then save and
close the presentation before doing the next in the folder. Have any
of you done anything like this? My testing shows that each TextFrame
has a different object number. Is this true? Have any of you
selected each TextFrame object in a presentation and tested it's
contents for a particular value?

Thank you for your time.

Best Regards,
Jeff Jones
jeffrey.p.jones@eds.com
 
Youmay perhaps play with the Tags collections.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thank you PH. I'll look into the Tags Collection.
Jeff
 
Here's the code I've developed thus far.

Sub ChangeHyperLinkData()

Dim oSld As Slide
Dim oAgenda As TextRange
'Stop
ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Count
Set oSld = ActivePresentation.Slides(ActivePresentation.Slides.Count)

ActiveWindow.Selection.SlideRange.Shapes("Rectangle 17").Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select

With ActivePresentation.Slides(ActivePresentation.Slides.Count)
Set oAgenda = ActiveWindow.Selection.ShapeRange.TextFrame.TextRange
End With

With oAgenda.Sentences(1) _
.ActionSettings(ppMouseClick).Hyperlink
.Address = "< "
.TextToDisplay = "Americas: < " & vbNewLine
.SubAddress = ""
End With
With oAgenda.Sentences(2) _
.ActionSettings(ppMouseClick).Hyperlink
.Address = "< "
.TextToDisplay = "Asia Pacific: < " & vbNewLine
.SubAddress = ""
End With
With oAgenda.Sentences(3) _
.ActionSettings(ppMouseClick).Hyperlink
.Address = "< "
.TextToDisplay = "Europe & Africa: < "
.SubAddress = ""
End With

End Sub

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

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 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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top