locked
Create a dynamic hyperlink in a picture. RRS feed

  • Question

  • Hello forum,

    I need a little help with adding a dynamic hyperlink to an image. Essentially what I have is a drop down box with a list of games. On the same sheet, I have an image with the Wikipedia icon. What I would like to do is select the game from from the drop down list and be able to click on the Wikipedia image on the sheet and have my browser open to the Wikipedia page of the game that is selected in the dropdown box. I know very little about VBA but assume that's what I'll have to use to accomplish this. 

    I appreciate your help and hopefully I've explained this pretty clearly. Thanks in advance.

    Monday, March 24, 2014 4:15 PM

Answers

  • Hi nw968,

    >> What I would like to do is select the game from the drop down list and be able to click on the Wikipedia image on the sheet and have my browser open to the Wikipedia page of the game that is selected in the dropdown box.

    You could use the code below to update the hyperlink of Wiki Icon.

    Sub UpdateHyperLinkOfShape()
    
        Dim sht As Worksheet
        
        Dim targetShape As Shape
        
        Set sht = Application.ActiveSheet
        
        Set targetShape = sht.Shapes(3)
        
        targetShape.Hyperlink.Address = "http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel._worksheet.shapes(v=office.14).aspx"
    End Sub

    Hope it will help.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by George Hua Tuesday, April 8, 2014 1:56 AM
    • Marked as answer by George Hua Tuesday, April 8, 2014 1:57 AM
    Monday, April 7, 2014 7:36 AM

All replies

  • I hope the Table from which the ComboBox is getting data has the first column with the name of the game and the second column with the Address of Wikipedia. If that is so, the code will be relatively simple. If not explain what is the table structure you have in place.

    Happy to help ! When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answered

    Monday, March 24, 2014 5:24 PM
  • Thanks for the help Paul. 

    Yes, the table has the name in the first column and the url in the second column. However, the data is being pulled from a separate tab. I've shared out a sample of the file in the link if you want to take a look. 

    http://1drv.ms/1kYvHDE

    Unfortunately, onedrive is garbage when it comes to sharing out. I've updated the link.

    • Edited by nw968 Monday, March 24, 2014 7:58 PM
    Monday, March 24, 2014 7:54 PM
  • Hey Paul,

    Have you had a chance to take a look at the sheet?

    Thursday, March 27, 2014 4:38 PM
  • Hi nw968,

    >> What I would like to do is select the game from the drop down list and be able to click on the Wikipedia image on the sheet and have my browser open to the Wikipedia page of the game that is selected in the dropdown box.

    You could use the code below to update the hyperlink of Wiki Icon.

    Sub UpdateHyperLinkOfShape()
    
        Dim sht As Worksheet
        
        Dim targetShape As Shape
        
        Set sht = Application.ActiveSheet
        
        Set targetShape = sht.Shapes(3)
        
        targetShape.Hyperlink.Address = "http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel._worksheet.shapes(v=office.14).aspx"
    End Sub

    Hope it will help.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by George Hua Tuesday, April 8, 2014 1:56 AM
    • Marked as answer by George Hua Tuesday, April 8, 2014 1:57 AM
    Monday, April 7, 2014 7:36 AM