×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Need variable in hyperlink.subaddress (PP)

Need variable in hyperlink.subaddress (PP)

Need variable in hyperlink.subaddress (PP)

(OP)
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.  



RE: Need variable in hyperlink.subaddress (PP)

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: www.essexsteam.co.uk

RE: Need variable in hyperlink.subaddress (PP)

(OP)
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 .....

RE: Need variable in hyperlink.subaddress (PP)

(OP)
"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.  

RE: Need variable in hyperlink.subaddress (PP)

(OP)
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.

RE: Need variable in hyperlink.subaddress (PP)

(OP)
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
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbapp11/html/ppproSubAddress1_HV05193844.asp

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources