+ Reply to Thread
Results 1 to 4 of 4

How do I insert a PictureBox into Excel?

  1. #1
    Evanbron
    Guest

    How do I insert a PictureBox into Excel?

    I don't know much about VBA. Is there any way to easily insert a PictureBox
    into an Excel worksheet so that a .jpg file can be selected from a directory
    of .jpg files and loaded to the worksheet?

    Thanks,

    Evanbron

  2. #2
    exceluserforeman
    Guest

    RE: How do I insert a PictureBox into Excel?

    Hi,
    Just off-hand, You could use a userform with an image control, a list box
    with a list of the picture locations and a button to insert picture into the
    image control. If the desired pictured is acceptable, use another button to
    insert the picture into the worksheet.

    If you would like me to create this project for you, you can send me the
    relevant info.
    See my user stuff at http://www.geocities.com/excelmarksway

    - Mark
    PS I just might do it anyhow and post it to my Excel site in a couple of
    days...

    "Evanbron" wrote:

    > I don't know much about VBA. Is there any way to easily insert a PictureBox
    > into an Excel worksheet so that a .jpg file can be selected from a directory
    > of .jpg files and loaded to the worksheet?
    >
    > Thanks,
    >
    > Evanbron


  3. #3
    Rowan Drummond
    Guest

    Re: How do I insert a PictureBox into Excel?

    This will place the picture on the sheet at the currently selected cell.

    Sub JPeg()
    Dim flname As Variant
    flname = Application.GetOpenFilename
    If flname <> False Then
    If Right(flname, 3) = "jpg" Then
    ActiveSheet.Pictures.Insert (flname)
    Else
    MsgBox "That is not a jpeg file"
    End If
    End If
    End Sub

    Hope this helps
    Rowan

    Evanbron wrote:
    > I don't know much about VBA. Is there any way to easily insert a PictureBox
    > into an Excel worksheet so that a .jpg file can be selected from a directory
    > of .jpg files and loaded to the worksheet?
    >
    > Thanks,
    >
    > Evanbron


  4. #4
    exceluserforeman
    Guest

    RE: How do I insert a PictureBox into Excel?

    Hi,
    Rowan's answer is good. I have implemented the same macro to a userform
    utility.
    Here is how it works:
    Click the Open Folder Picture button to show the Open Dialog
    Click Cancel when you have found the Folder you want. The Open Dialog does
    not open any files should you click the OPEN button.
    The file types have been preset in the Open Dialog.
    The Folder Location textbox shows your selected Folder of Picture Files.
    The File Type combobox shows you the type of file types allowed for the
    image control.
    The Files in the Current Folder listbox shows the compatible files. Click an
    item in the listbox to load it into the image control.
    Insert Picture button inserts the selected picture into the current active
    worksheet.
    The Hide Pic Box button allows you to hide the main form so you can get a
    better view of the inserted picture. A small form is shown at the Top-Left of
    your screen so you can reload the main form when you are ready.
    Also, I have resized the picture to approx. 1/3 the original size. Good for
    large pictures, no good if you import an icon or small picture...
    You can download it from http://www.geocities.com/excelmarksway
    [email protected]
    24 October 2005

    "Evanbron" wrote:

    > I don't know much about VBA. Is there any way to easily insert a PictureBox
    > into an Excel worksheet so that a .jpg file can be selected from a directory
    > of .jpg files and loaded to the worksheet?
    >
    > Thanks,
    >
    > Evanbron


+ 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