Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Need variable in hyperlink.subaddress (PP)

Status
Not open for further replies.

Rebam98

Computer
Mar 28, 2006
14
Hi-

I'm trying to automatically insert a hyperlink into a text box based on what the text of the text box is. I am using PowerPoint.

What slide the text box links to can be linked based on the title of the slide. For instance, the title of the slide might be "John_Slide" while the text in the text box is "John." I want to be able to use the "John" to find "John_Slide".

I am able to extract what text is in the text box and assign it a variable. So say x = "John".

Now I want to insert a hyperlink based on the variable. The problem is the generic template of the hyperlink.subaddress looks like this,

ActiveWindow.Selection.SlideRange.Shapes("Text Box 4").Select
With ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseClick).Hyperlink
.Address = ""
.SubAddress = ",,Slide_Title"
.ScreenTip = ""
.TextToDisplay = ""


Where "Slide_Title" exists I want to put the equivalant of X & "_Slide", where X is the variable, in this case it would stand for "John" thus creating the slide title, "John_Slide."

With the quotes around the whole subaddress string, I don't know how to do this.

As usual, any insight would be greatly appreciated.



 
Replies continue below

Recommended for you

The ampersand is the string concatenator, so just join up the three parts that you need, using Trim function on your variable to ensure there are no extraneous spaces:
Code:
        .SubAddress = ",," & Trim(x) & "_Title"

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

Steam Engine enthusiasts:
 
Thanks! But it looks like I jumped ahead of myself. Now I can't even get the hyperlink.subaddress to insert a hyperlink based on the slide title. So say the text box is already selected, and I have a slide that has a title of "John_Slide," I use this code,

With ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseClick).Hyperlink
.Address = ""
'.SubAddress = ",3,"
.SubAddress = ",,John_Slide"
.TextToDisplay = ""
End With

.. and for the hyperlink, it inserts the following, "#,,Tom_Slide", and it is in the section for "Existing file or web page."

By "slide title" I mean the text box where it says "Click to Add Title." When I insert the hyperlink manually, it does say the slide title I added, e.g. John_Slide.

I looked through the book I have on VBA in the section on PP, but I found very little and my internet searches are not proving fruitful. It seems like I am missing something very minor .....
 
"and for the hyperlink, it inserts the following, "#,,Tom_Slide", and it is in the section for "Existing file or web page." "


... sorry I meant to say John_Slide, but the principle still applies.
 
This is what someone else said,

"It's failing because when you call the link, you're calling an empty link. The only info you have is slide title.
",,Tom_Slide"

An empty link location is the same as a link to "#" (that's why the link is displaying as #). You're getting errors because the code is saying "linking to an empty location with the title "Tom_Slide". You need variables for where the empty spaces are. You can't just use the slide title as the way to link. You have to use the slide ID and slide index."

Can you really not find something by slide title? That seems a little weird to me - why even have it? [sadeyes]

I will continue to find some other way to reference the slides.
 
I think I figured it out!! My mistake was I was going to the text box in 'normal' view, going to "Edit hyperlink" and was hoping I would see my link. But I saw nothing, no hyperlink was inserted. But when I PLAY the show, it DOES hyperlink to where I said for it to go. The below tutorial partially taught me how to do it,

Microsoftcom's link on hyperlink.subaddress

I have a problem with the direction on here though, it says,

"This example sets shape one on slide one in the active presentation to jump to the slide named "Last Quarter" in Latest Figures.ppt when the shape is clicked during a slide show."

This suggests to me that it is the NAME of the slide that you need to reference. But I just played around with it and it very definitely wants to find a slide title, not the name of the slide.

I did not type in the .address as suggested on the tutorial because this pp pressie is going to be uploaded to a different website and I want the link to go to a spot inside the pressie regardless where it is located. I hope that actually works ....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor