+ Reply to Thread
Results 1 to 9 of 9

Macro to add Images in Excel file

  1. #1
    Registered User
    Join Date
    11-15-2022
    Location
    London
    MS-Off Ver
    Microsoft Excel for Mac - Version 16.66.1
    Posts
    6

    Macro to add Images in Excel file

    Hello,

    I am reaching out to you to get help on building a macro.
    Unfortunately I am far from being an expert in setting up macros but running one could make my life much easier.

    I am currently trying to create a macro using pictures saved on my computer.
    I have renamed the picture to align with column A (e.g., 19PFAMRSBLWLAR.jpg) but I cannot figure out how to have the image pulling through in column B.
    I have spent the afternoon trying to work it out, watching videos on YouTube but I haven't managed to find a solution.

    What would be the best way to do it?

    Many thanks,

    Pierre-Baptiste.
    Attached Files Attached Files

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,467

    Re: Macro to add Images in Excel file

    Hi there,

    Without access to your file structure it's a bit difficult to test this fully, but see if the following code gets you moving in the right direction:

    Please Login or Register  to view this content.
    The highlighted value may be changed to suit your own requirements.


    Select the cell (in Column A) which contains the picture you want to import, and then run the code - the selected picture will be imported to Column B.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,367

    Re: Macro to add Images in Excel file

    How about:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-15-2022
    Location
    London
    MS-Off Ver
    Microsoft Excel for Mac - Version 16.66.1
    Posts
    6

    Re: Macro to add Images in Excel file

    Hi Greg M,
    Hi JEC.,

    Thank you very much for your support.
    I have tried to enter both code and none of them is successful.

    I don't know if it helps but here the name of the folder where the pictures are being saved: /Users/pierre-baptisterondeau/Desktop/Product Images

    Many thanks,

    Pierre-Baptiste.

  5. #5
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,467

    Re: Macro to add Images in Excel file

    Hi again,

    Try:

    Please Login or Register  to view this content.
    Remember that you must select the cell which contains the name of the image you wish to import before running the code.


    If this is unsuccessful, can you let us know which error message you are receiving, and on which line of code the error occurs?


    Regards,

    Greg M

  6. #6
    Registered User
    Join Date
    11-15-2022
    Location
    London
    MS-Off Ver
    Microsoft Excel for Mac - Version 16.66.1
    Posts
    6

    Re: Macro to add Images in Excel file

    Hi Greg M,

    I have updated the code and it seems to be working halfway.
    I now have an icon showing up but it is blank ('the picture can't be displayed').

    I have double checked my folder and this image is available in .jpg so not sure where the issue is coming from...

    Many thanks,

    Pierre-Baptiste.

  7. #7
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,467

    Re: Macro to add Images in Excel file

    Hi again,

    This sort of problem is difficult to diagnose by "remote control"!

    Can you post your image file here and I'll see if I can import it on my system.

    Regards,

    Greg M

  8. #8
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,367

    Re: Macro to add Images in Excel file

    What if you change the path in my code to the correct path?

  9. #9
    Valued Forum Contributor
    Join Date
    08-07-2014
    Location
    Quito, Ecuador
    MS-Off Ver
    Excel 2016 & 365, Windows 10
    Posts
    511

    Re: Macro to add Images in Excel file

    Hi PBaptiste

    Just to be sure, I found two differences between GregM's and Jec's codes, that you'd check carefully:
    in GregM's code you must put path without "backslash" at the end ; and the file names must jave ".jpg" at the end.
    while in Jec's code is the oposite: path must have "backslash" at the end ; and file names must go without ".jpg"

    with these in mind, both codes are running well
    Barriers are there for those who don't want to dream

+ 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. Extract Images To File From Excel
    By bs1977 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-19-2021, 08:48 AM
  2. images as links to images saved in file
    By scottiex in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-16-2020, 04:07 PM
  3. [SOLVED] upload images in excel file
    By anilpatni1234 in forum Excel Programming / VBA / Macros
    Replies: 50
    Last Post: 05-01-2019, 04:27 AM
  4. Macro to Insert images & file names
    By bobsy852 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-15-2019, 09:22 AM
  5. [SOLVED] Save images from excel file VBA
    By R12345 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-16-2016, 01:21 PM
  6. Replies: 2
    Last Post: 07-25-2016, 03:39 AM
  7. Excel File & Hyperlinking images
    By jacksonmathews in forum Excel General
    Replies: 2
    Last Post: 12-13-2008, 08:14 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