+ Reply to Thread
Results 1 to 21 of 21

Hyperlink text to image

  1. #1
    Forum Contributor
    Join Date
    06-10-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016
    Posts
    132

    Hyperlink text to image

    hey Everyone

    i have a question for the board

    i have a file with 1500 row, they are personal information. in the file there are 3 columns, picture, passport, Visa

    i have a formula that automatically populate the name of the Picture, Passport and visa, and the relevant document are named the same.
    Question:

    is there a way to bulk hyperlink the file name so that when i click on the name of a Visa, the correspondent picture would come out?

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Hyperlink text to image

    Hello,
    Where is the picture to "Come Out" to?

  3. #3
    Forum Contributor
    Join Date
    06-10-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016
    Posts
    132

    Re: Hyperlink text to image

    Quote Originally Posted by davesexcel View Post
    Hello,
    Where is the picture to "Come Out" to?
    Sorry, don't understand the question

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Hyperlink text to image

    The last line of your question

  5. #5
    Forum Contributor
    Join Date
    06-10-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016
    Posts
    132

    Re: Hyperlink text to image

    Quote Originally Posted by davesexcel View Post
    The last line of your question
    I just need the picture to be displayed, outside excel

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Hyperlink text to image

    Using the worksheet_selection_change event should do what you need.

    Make a folder with the files names, they need to match the names in column P
    -
    -
    Pic1.JPG
    -
    right click on the sheet tab and select "View Code"

    -
    RightClickTab.jpg
    -
    This is where you edit the folder address in the code.
    -
    Pic2.JPG
    -
    Click the Cells in column P and the photos will show in Range("S1:X13")
    -
    Pic3.JPGPic4.JPG
    -
    Please Login or Register  to view this content.
    I can't seem to add the attachment to this post, I will try in a different post

  7. #7
    Forum Contributor
    Join Date
    06-10-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016
    Posts
    132

    Re: Hyperlink text to image

    Quote Originally Posted by davesexcel View Post
    Using the worksheet_selection_change event should do what you need.

    Make a folder with the files names, they need to match the names in column P
    -
    -
    Attachment 581136
    -
    right click on the sheet tab and select "View Code"

    -
    Attachment 581137
    -
    This is where you edit the folder address in the code.
    -
    Attachment 581138
    -
    Click the Cells in column P and the photos will show in Range("S1:X13")
    -
    Attachment 581139Attachment 581140
    -
    Please Login or Register  to view this content.
    I can't seem to add the attachment to this post, I will try in a different post


    thank you I will give it a go and let you know.

    thank you very much for this

  8. #8
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Hyperlink text to image

    Workbook attached.

  9. #9
    Forum Contributor
    Join Date
    06-10-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016
    Posts
    132

    Re: Hyperlink text to image

    Quote Originally Posted by davesexcel View Post
    Workbook attached.
    dear Dave, thank you for the file

    i was able to make it work
    Attached Images Attached Images
    Last edited by didierkassas; 07-10-2018 at 12:40 AM.

  10. #10
    Forum Contributor
    Join Date
    06-10-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016
    Posts
    132

    Re: Hyperlink text to image

    Quote Originally Posted by didierkassas View Post
    dear Dave, thank you for the file

    i was able to make it work
    Dear Dave,

    i am sorry to bother you again but the person i am doing the excel for is wandering if it's possible to have the image display outside of Excel.

    so basically, once you click on the cell the image viewer would open displaying the image.

    Thank you
    Didier

  11. #11
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Hyperlink text to image

    shell command should do the trick

    Please Login or Register  to view this content.
    taken from here
    https://www.mrexcel.com/forum/excel-...-jpg-file.html
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  12. #12
    Forum Contributor
    Join Date
    06-10-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016
    Posts
    132

    Re: Hyperlink text to image

    dear Humdi,

    do i add this in addition to the existing VBA Code? or just replace the entire thing?

  13. #13
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Hyperlink text to image

    in addition

    first line sets the path & file
    the shell line launches external viewer

    place the line where ever you want launch it

    you probably need an error catch should the path/filename not exist

  14. #14
    Forum Contributor
    Join Date
    06-10-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016
    Posts
    132

    Re: Hyperlink text to image

    This is the code that i am using at the moment,

    the path is located in A1

    where would you add the code line?




    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim sh As Worksheet
    Dim PcRng As Range
    Dim rng As Range
    Dim Filepath As String
    Filepath = ActiveSheet.Range("A1").Value
    Shell ("RunDLL32.exe C:\Windows\System32\Shimgvw.dll,ImageView_Fullscreen " & Filepath)

    Set sh = Sheets("Accreditation")


    If Target.Column <> 14 Then Exit Sub
    If Target.Row < 4 Then Exit Sub


    With sh
    .Pictures.Delete
    Set PcRng = .Range("S1:X13")
    Set myRng = PcRng.Areas(1)
    Set myPict = myRng.Parent.Pictures.Insert("filapath" & Target.Value & ".jpg")
    myPict.Left = myRng.Left
    myPict.Top = myRng.Top
    myPict.Height = myRng.Height
    myPict.Width = myRng.Width
    myPict.Placement = xlMoveAndSize
    End With

    End Sub

  15. #15
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Hyperlink text to image

    i assume you still want the picture in excel itself

    Please Login or Register  to view this content.
    changed the variable to strFile to be less confusing than Filepath ...which means to me only the path/directory

  16. #16
    Forum Contributor
    Join Date
    06-10-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016
    Posts
    132

    Re: Hyperlink text to image

    Dear Humding

    we are nearly there

    i actually needed to have the file path as i want to refer to a specific cell as the location of the images may change
    so i changed the code as per the below



    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim sh As Worksheet
    Dim PcRng As Range
    Dim rng As Range
    Dim strFile As String

    Set sh = Sheets("Accreditation")

    If Target.Column < 14 Then Exit Sub
    If Target.Row < 4 Then Exit Sub

    'Assume this is fixed
    FilePath = ActiveSheet.Range("u1").Value


    'load external viewer
    Shell ("RunDLL32.exe C:\Windows\System32\Shimgvw.dll,ImageView_Fullscreen " & FilePath)

    End Sub



    it works in the sence that if i change the path then the image still shows, the problem now is that it always shows the same image instead of changing . i have attached the Excel
    Attached Files Attached Files

  17. #17
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Hyperlink text to image

    add target.value to the line

    Please Login or Register  to view this content.

    ps you should probably target column as well
    Please Login or Register  to view this content.
    just so it doesn't run when you select column R on wards
    Last edited by humdingaling; 07-18-2018 at 08:47 PM.

  18. #18
    Forum Contributor
    Join Date
    06-10-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016
    Posts
    132

    Re: Hyperlink text to image

    Quote Originally Posted by humdingaling View Post
    add target.value to the line

    Please Login or Register  to view this content.

    ps you should probably target column as well
    Please Login or Register  to view this content.
    just so it doesn't run when you select column R on wards
    Dear Humdingaling

    tried the lines of code that you suggested but nothing happens,

    any ideas why this would be?

  19. #19
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Hyperlink text to image

    oops forgot the file extension

    Please Login or Register  to view this content.

  20. #20
    Forum Contributor
    Join Date
    06-10-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016
    Posts
    132

    Re: Hyperlink text to image

    YAY!!! it works exactly as i wanted,

    thank you so much

  21. #21
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Hyperlink text to image

    glad to see it finally worked

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Inserting image into userform label, text behind image?!?!
    By spyrule in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 08-31-2016, 03:23 PM
  2. VBA: Put text from excel to jpeg image by matching image name.
    By sroysroy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-12-2013, 01:47 AM
  3. Replies: 5
    Last Post: 06-18-2013, 11:54 PM
  4. Connect image to hyperlink (web URL)
    By Nostalgia80 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-21-2013, 11:01 AM
  5. Adding Image into a excel cell and adding a hyperlink to the image
    By saravananiyyanar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-05-2011, 04:16 AM
  6. Need Help-Add Image to a hyperlink
    By Ashish82 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-29-2008, 06:09 PM
  7. Hyperlink to an image in other worksheet, displaying entire image.
    By twilliams in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-07-2006, 06:10 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1