+ Reply to Thread
Results 1 to 4 of 4

Importing pictures from file

  1. #1
    Registered User
    Join Date
    03-10-2008
    Location
    Colchester, UK
    MS-Off Ver
    Excel 2007
    Posts
    13

    Importing pictures from file

    HI
    I'm trying to create a geography project for my upcoming primary class but my Excel expertise is limited.
    I am trying to import small jpg's from a folder and then make them appear in a userform or Msgbox. Is it possible?

    So far I've created a very simple way to display the text in a message box but I would also like to be able to display the flag. Macros 2 & 3 are initiated by clicking on images while macro1 displays the information:
    Please Login or Register  to view this content.
    If it makes it easier, the name of the image matches the text in cell A1. eg The flag for France is in 'C:\Users\Pictures\Flags\France', the flag for England is in 'C:\Users\Pictures\Flags\England', etc

    I would be grateful for any much needed help
    Last edited by Leith Ross; 08-15-2009 at 06:32 PM. Reason: Added Code Tags

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Importing pictures from file

    You can't put a picture in a msgbox -- you'd have to use an image control on a form. Then I think you'd have problems because the aspect of the image control is fixed at design time, but the aspect of flags vary.

    You could put it on the sheet:
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Importing pictures from file

    Hello Kenny07,

    Welcome to the Forum!

    The attached workbook will display the flag of the country entered into cell "A1" on "Sheet1". The file is loaded from the folder you gave using the country name in "A1" and adding the ".jpg" extension. This happens every time the contents of cell "A1" change. A VBA UserForm is used to display the welcome message and the country flag. Here is the associated code...

    UserForm Code
    Please Login or Register  to view this content.
    Sheet1 Code
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    03-10-2008
    Location
    Colchester, UK
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Importing pictures from file

    Thanks for both the replies.
    That's exactly what I wanted Leith - it works perfectly
    It never ceases to amaze me just how helpful some of you people on this forum are. Thanks again.

+ 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