+ Reply to Thread
Results 1 to 6 of 6

Pull pictures from folder to excel sheet...HELP

Hybrid View

  1. #1
    Registered User
    Join Date
    12-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    31

    Pull pictures from folder to excel sheet...HELP

    I have an excel sheet where column B has a list of product codes. I also have a folder with pictures of each product and file name of the pictures are the product code. I would like to place the picture of each product in column A beside their respective codes. If possible, I would also like to reformat the pictures so they fit in the cell. (3.00 x 3.85)

    Need a Macro that can run this.
    I don't really know where to start and any help would be greatly appreciated! thanks

  2. #2
    Forum Contributor
    Join Date
    09-24-2013
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    128

    Re: Pull pictures from folder to excel sheet...HELP

    Hi,

    The following code will insert a picture in the active cell of the work sheet.

    Sub InsertPicture()
    Dim sPicture As String, pic As Picture
    sPicture = Application.GetOpenFilename _
        ("Pictures (*.gif; *.jpg; *.bmp; *.tif), *.gif; *.jpg; *.bmp; *.tif", _
         , "Select Picture to Import")
     
    If sPicture = "False" Then Exit Sub
    
    Set pic = ActiveSheet.Pictures.Insert(sPicture)
    With pic
        .ShapeRange.LockAspectRatio = msoFalse
        .Height = ActiveCell.Height
        .Width = ActiveCell.Width
        .Top = ActiveCell.Top
        .Left = ActiveCell.Left
        .Placement = xlMoveAndSize
    End With
    Set pic = Nothing
     
    End Sub
    hope this helps.. let me know..

  3. #3
    Registered User
    Join Date
    12-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    31

    Re: Pull pictures from folder to excel sheet...HELP

    Quote Originally Posted by moonsaga View Post
    Hi,

    The following code will insert a picture in the active cell of the work sheet.

    Sub InsertPicture()
    Dim sPicture As String, pic As Picture
    sPicture = Application.GetOpenFilename _
        ("Pictures (*.gif; *.jpg; *.bmp; *.tif), *.gif; *.jpg; *.bmp; *.tif", _
         , "Select Picture to Import")
     
    If sPicture = "False" Then Exit Sub
    
    Set pic = ActiveSheet.Pictures.Insert(sPicture)
    With pic
        .ShapeRange.LockAspectRatio = msoFalse
        .Height = ActiveCell.Height
        .Width = ActiveCell.Width
        .Top = ActiveCell.Top
        .Left = ActiveCell.Left
        .Placement = xlMoveAndSize
    End With
    Set pic = Nothing
     
    End Sub
    hope this helps.. let me know..
    where do I insert the -
    -folder name with the pictures
    -which column I want the pictures and which column has the style numbers (in my case a has the pics and b has the style numbers)

  4. #4
    Forum Contributor
    Join Date
    09-24-2013
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    128

    Re: Pull pictures from folder to excel sheet...HELP

    The code i provided uses the import picture feature of excel and puts the picture in the active cell of the sheet.

    open a new excel workbook
    right click on sheet1 tab
    select view code
    and paste the code in the open window
    save workbook
    go back to excel
    then hit "ALT + F8" to open the run macro box
    then highlight the macro
    and click on run.

    then you will see what the macro does.

  5. #5
    Registered User
    Join Date
    12-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    31

    Re: Pull pictures from folder to excel sheet...HELP

    Quote Originally Posted by moonsaga View Post
    The code i provided uses the import picture feature of excel and puts the picture in the active cell of the sheet.

    open a new excel workbook
    right click on sheet1 tab
    select view code
    and paste the code in the open window
    save workbook
    go back to excel
    then hit "ALT + F8" to open the run macro box
    then highlight the macro
    and click on run.

    then you will see what the macro does.

    What I want to be able to do is as follows:
    I have a sheet
    Column B has 50 style numbers (ex: "AK12323)
    In folder "C:\Documents and Settings\Admin\Desktop\Images For Stock List" on my PC I have 50 pictures with the style numbers as the file name.
    I want to be able to press for example "Ctrl+Q" and column A will populate with the corresponding pictures from the folder on my pc.
    Ive seen it done a long time ago ,so I know its possible.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Pull pictures from folder to excel sheet...HELP

    iowits, please don't quote whole posts -- it's just clutter. If you are responding to a post out of sequence, limit quoted content to a few relevant lines that makes clear to whom and what you are responding.

    Thanks
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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. i need a macro to pull excel files from a folder and print them
    By kmraz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-06-2013, 06:53 PM
  2. [SOLVED] Excel macro to pull retrieve data from multiple workbooks in a folder
    By tech_frk in forum Excel Programming / VBA / Macros
    Replies: 39
    Last Post: 03-07-2013, 08:04 PM
  3. [SOLVED] Want to Pull File Names From Folder into Excel
    By lytsty in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-06-2012, 08:33 PM
  4. Pull out numbers and text from 10+ excel files in a folder
    By ammarkhan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-24-2012, 03:17 PM
  5. [SOLVED] pull pictures by using Vlookup?
    By all4excel in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-23-2008, 03:13 PM

Tags for this Thread

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