+ Reply to Thread
Results 1 to 14 of 14

VBA Multiple image insert MACRO from file folder.

  1. #1
    Registered User
    Join Date
    09-11-2019
    Location
    Torquay
    MS-Off Ver
    2013
    Posts
    7

    VBA Multiple image insert MACRO from file folder.

    Hi All.

    I am desperate to get a macro sorted for a quotation PDF I am using.

    I need to insert multiple images from a file folder saved with the specific names of the item.

    I.E.

    A2:E3 (MERGED CELL) Will contain an item code. The image for this item code is saved in a folder with the same file name.

    I need the image to appear in B6:D16. (MERGED CELL)

    I then need this to repeat for the remainder of product codes and images.

    The product code appears in every 18th Row so the next is A20:E21 and A38:E39 so on.

    The images need to appear in every 18th Row so the next is B24:D34 and B42:D52 so on.

    I am ok to re size the images, just need the placement sorted in the specific cells.

    Please help.

    Matt.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA Multiple image insert MACRO from file folder.

    Change the image file path and file extension to suit.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    09-11-2019
    Location
    Torquay
    MS-Off Ver
    2013
    Posts
    7

    Re: VBA Multiple image insert MACRO from file folder.

    Hi AlphaFrog.

    Firstly, Thank you so much for your speedy response. I really do appreciate it.

    Secondly, It has worked for the first image but does not repeat on to the next images..... Is there an easy fix for this?

    Cheers in advance, Matt.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA Multiple image insert MACRO from file folder.

    It should work for the others. Check if the file names match the cell values.

    Are the Cell values really 18 apart; A2, A20, A38 etc.?

  5. #5
    Registered User
    Join Date
    09-11-2019
    Location
    Torquay
    MS-Off Ver
    2013
    Posts
    7

    Re: VBA Multiple image insert MACRO from file folder.

    Hi Yes.

    So next item code cell is A20:E21 and image should appear in B24:D34.

    Product codes match image names exactly. All images are JPG.

    Sorry buddy, I hope its not me doing something wrong....

    Matt.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA Multiple image insert MACRO from file folder.

    It works for me on a test sheet I made. Can you attach an example file?

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA Multiple image insert MACRO from file folder.

    It works for me on my test worksheet. Can you attach an example workbook?

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA Multiple image insert MACRO from file folder.

    It works for me on my test worksheet. Can you attach an example workbook?

  9. #9
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA Multiple image insert MACRO from file folder.

    It works for me on my test worksheet. Can you attach an example workbook?

  10. #10
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA Multiple image insert MACRO from file folder.

    Sorry for the multiple replies. The site wasn't updating even though it recorded all of my attempts. It eventually updated with every reply.

  11. #11
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: VBA Multiple image insert MACRO from file folder.

    That happened to me too in another thread.

    Merged cells are kind of a bane to coders. One easy way to deal with this here is to use an unused range for our counting and offset from there. If you need my example file to play with, just post back. And by the way, welcome to the forum!

    Please Login or Register  to view this content.
    Last edited by Kenneth Hobson; 09-12-2019 at 09:47 PM.

  12. #12
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA Multiple image insert MACRO from file folder.

    @Hobson

    Merged cell shouldn't pose a problem in this case. My test file had merged cells as the OP described it.

  13. #13
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: VBA Multiple image insert MACRO from file folder.

    It did for me. Here is my file so we can compare apples to apples.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    09-11-2019
    Location
    Torquay
    MS-Off Ver
    2013
    Posts
    7

    Re: VBA Multiple image insert MACRO from file folder.

    Guys,

    I cant thank you all enough. It works really well.

    I don't know why it didn't work first time, maybe something to do with the module I set up but it definitely works now for all 1798 lines.

    Thank you all again. I really appreciate it.
    Matt.

+ 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. Choose folder then file when insert image
    By redapa1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-07-2016, 04:05 PM
  2. [SOLVED] Insert Image into Mail from Folder in which Workbook is stored
    By Jonathan78 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-21-2016, 02:44 PM
  3. VBA to Open a folder to then select an image that will insert in spredsheet
    By mitchellA in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-04-2016, 09:05 AM
  4. Insert Image in ImageBox after clicking it on folder
    By brainzlp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-04-2015, 07:44 AM
  5. [SOLVED] (VBA) Insert image from a folder
    By Zgoda in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-25-2015, 12:02 PM
  6. macro script to search and hyperlink image file from folder
    By shamiul in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-15-2013, 12:09 PM
  7. [SOLVED] Insert jpg image from file path to image frame
    By SAsplin in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-27-2012, 10:12 AM

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