+ Reply to Thread
Results 1 to 3 of 3

Import Pictures and File Names from folder

  1. #1
    Registered User
    Join Date
    07-25-2014
    Location
    Oftringen, Switzerland
    MS-Off Ver
    Professional Plus 2010
    Posts
    16

    Import Pictures and File Names from folder

    Hello all

    I have a folder with more than 100 pictures and I would like to import the pictures and their file names into Excel 2013. The objective is to have each picture added to A2,A3,A4,A5, and so forth and their file names appended to B1,B2,B3,B4,B5 respectively.

    Thank you for your help.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Import Pictures and File Names from folder

    Hi CC_deallist,

    See the attached file which was tested successfully using Excel 2003 and 32 bit Excel 2010. Originally I thought I would be able to use 'Pictures.Insert()', however it would not allow the pictures to be imported in Excel 2010. It would only use links to the file in Excel 2010.

    I was successful in Excel 2010 using 'Shapes.AddPicture()'.

    Complete code follows in an ordinary code module such as Module1. Items in red can be modified to customize to your situation:
    Please Login or Register  to view this content.
    Additional information that may be helpful:

    It is a best practice to declare all variables. If you misspell a variable in your code, VBA will silently assume it is a Variant variable and go on executing with no clue to you that you have a bug. Go to the VBA development window, click Tools, Options, and check "Require Variable Declaration." This will insert the following line at the top of all new modules:
    Please Login or Register  to view this content.
    This option requires all variables to be declared and will give a compiler error for undeclared variables.

    To enable Macros and to Run Macros see the following:
    http://office.microsoft.com/en-us/ex...010031071.aspx
    http://office.microsoft.com/en-us/ex...010014113.aspx
    If help is still needed do a google search for 'youtube excel enable macro' and/or 'youtube excel run macro'.

    To access Visual Basic (VBA) see:
    http://www.ablebits.com/office-addin...a-macro-excel/
    a. Click on any cell in the Excel Spreadsheet (may not be needed).
    b. ALT-F11 to get to VBA.
    c. CTRL-R to get project explorer (if it isn't already showing).
    d. Double Click on a 'Module Name' in 'Project Explorer' to see code for that module.

    Debugger Secrets:
    a. Press 'F8' to single step (goes into subroutines and functions).
    b. Press SHIFT 'F8' to single step OVER subroutines and functions.
    c. Press CTRL 'F8' to stop at the line where the cursor is.
    d. 'Left Click' the margin to the left of a line to set (or clear) a BREAKPOINT.
    e. Press CTRL 'G' to open the IMMEDIATE WINDOW. 'debug.print' statements send their
    output to the IMMEDIATE WINDOW.
    f. Select View > Locals to see all variables while debugging.
    g. To automatically set a BREAKPOINT at a certain location put in the line:
    'Debug.Assert False'
    h. To conditionally set a BREAKPOINT at a certain location put in lines similar to:
    if i >= 20 and xTV20 > 99.56 then
    Debug.Assert False
    endif
    i. A variable value will be displayed by putting the cursor over the variable name.

    Lewis

  3. #3
    Registered User
    Join Date
    07-25-2014
    Location
    Oftringen, Switzerland
    MS-Off Ver
    Professional Plus 2010
    Posts
    16

    Re: Import Pictures and File Names from folder

    Hi Lewis

    Thank you very much for the code and for the detailed instructions.

    Much appreciate it, You, Kind Sir deserve a hearty hand clap.


+ 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. Requirement with folder names and file names
    By sateesh konduru in forum Excel General
    Replies: 3
    Last Post: 04-21-2015, 10:09 AM
  2. Import TXT files from a specific folder into Excel - TXT file names change hourly
    By jeepinjeff in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-16-2013, 04:08 AM
  3. Replies: 2
    Last Post: 11-28-2012, 04:45 PM
  4. importing pictures next to their file names in the excel sheet
    By sunilsoni7 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-26-2012, 09:22 AM
  5. [SOLVED] import every file in the folder and rename sheet to the imported file name
    By vivek_work in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-04-2012, 02:46 PM
  6. Import Folder names (1st level only) into excel
    By widodude in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-20-2011, 09:49 AM
  7. read in folder names and file names
    By gshock in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-11-2011, 12:45 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