+ Reply to Thread
Results 1 to 4 of 4

UserForm / image show based on the link from cell

  1. #1
    Registered User
    Join Date
    01-22-2013
    Location
    Poland
    MS-Off Ver
    Excel 365 64bits
    Posts
    46

    UserForm / image show based on the link from cell

    Dear All,

    I am looking for, most probably, simple vba code.
    I have a sheet called "Basic data" and in the cell D80 I have a path for an image.
    "c:\movies\matrix.jpg"

    D80 holds a formula vlook and find this link in the other sheet.

    I would like to load an image from D80 to the Image1 on UserForm1.
    I was digging for an answer over the Internet but I have not found proper code...
    Please Login or Register  to view this content.
    based on that code i got "File not found"

    2nd question is where to put the code? to the Sheet Code or keep it in the UserForm5.

    Thanks in advance for the suggestiosn!
    Last edited by sknalodz; 03-23-2013 at 08:40 AM.

  2. #2
    Forum Contributor
    Join Date
    12-31-2012
    Location
    Jhang, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: UserForm / image show based on the link from cell

    The value of D80 is a complete file path with extension, i.e. "c:\movies\matrix.jpg"
    Adding [& ".jpg"] in this line of your code doubles .jpg in that
    Please Login or Register  to view this content.
    and the path becomes "c:\movies\matrix.jpg.jpg"
    Just remove [& ".jpg"] and add "Set" keyword preceding this line:
    Please Login or Register  to view this content.
    Last edited by hafizimran; 03-23-2013 at 12:50 PM.

  3. #3
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: UserForm / image show based on the link from cell

    i would probably leave it in the userform module - run it from the activate event?
    Regards
    Sean

    Please add to my reputation if you think i helped
    (click on the star below the post)
    Mark threads as "Solved" if you have your answer
    (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code:
    [code] Your code here [code]
    Please supply a workbook containing example Data:
    It makes its easier to answer your problem & saves time!

  4. #4
    Registered User
    Join Date
    01-22-2013
    Location
    Poland
    MS-Off Ver
    Excel 365 64bits
    Posts
    46

    Re: UserForm / image show based on the link from cell

    Dear hafizimran,

    perfect, now it works. since I am learing VBA from web through some expamples I do such miastkes.

    anyway I have reached the effect!

    have a nice weekend.

    btw. i keep the macro on the button which opens the Userform. i put that code in front of USerForm5.Show

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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