Results 1 to 3 of 3

Thread: How to Insert a hyperlink in Powerpoint 2007

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Location
    Tallahassee FL
    Posts
    3

    Exclamation How to Insert a hyperlink in Powerpoint 2007

    How to Insert a hyperlink in Powerpoint 2007

    So you think you know how to insert a hyperlink? Well, think again. Microsoft has changed the internal code of Powerpoint 12. The old way of inserting hyperlinks won't work anymore.

    Here was my delimma. I needed to be able to programmatically insert a hyperlink into a slide when the user clicked my ribbon (menu) item. My old code looked like this

    VB Code:
    1. Sub test1()
    2. With Application.ActiveWindow.Selection.TextRange.ActionSettings _
    3. (ppMouseClick).Hyperlink
    4.  
    5. .Address = "C:\Documents and Settings\chris.dunsford\My Documents\test.doc"
    6. .SubAddress = ""
    7. .ScreenTip = ""
    8. .TextToDisplay = "test"
    9. End With
    10. End Sub


    So then I try running the code from Powerpoint help and the hyperlink seems to be inserted but no text will appear. Here is the code from Powerpoint help:


    VB Code:
    1. With ActivePresentation.Slides(1).Shapes(1) _
    2. .ActionSettings(ppMouseClick)
    3. .Action = ppActionHyperlink
    4. .Hyperlink.Address = "http://www.microsoft.com/"
    5. End With


    The code that finally works is:

    VB Code:
    1. Sub AddHyperlinkToSelection()
    2.  
    3.     Dim tr As TextRange
    4.  
    5.     Set tr = ActiveWindow.Selection.TextRange.InsertAfter("Hyperlink")
    6.  
    7.     tr.ActionSettings(ppMouseClick).Action = ppActionHyperlink
    8.  
    9.     tr.ActionSettings(ppMouseClick).Hyperlink.Address = "c:\test.doc"
    10.  
    11. End Sub

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: How to Insert a hyperlink in Powerpoint 2007

    Welcome to the Forums.


    Did you see from the help file that it wont be supported on a graphic?


    Returns or sets the display text for a hyperlink not associated with a graphic.
    Did you want to submit this as an Office Development FAQ?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Location
    Tallahassee FL
    Posts
    3

    Re: How to Insert a hyperlink in Powerpoint 2007

    I skipped over that
    I do think that this should be listed in the FAQ section. I was contemplating that when I posted it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width