+ Reply to Thread
Results 1 to 10 of 10

Attaching Pictures on Excel Spreadsheet using Path from the Cell Value

  1. #1
    Registered User
    Join Date
    09-16-2009
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    19

    Attaching Pictures on Excel Spreadsheet using Path from the Cell Value

    Hi, all.

    I been getting great help from everyone at this forum and had another question.

    Is it possible to put pictures from a path given in the excel spreadsheet?

    I have path of the pictures in a spreadsheet and would like to attach the pictures in the path to the cell next to it.

    For example, the path is in column A and would like to paste the pictures in column B.

    Any help and suggestions would be greatly appreciated.

    Thank you.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Attaching Pictures on Excel Spreadsheet using Path from the Cell Value

    I attached a file that contains code to read hyperlinks to images and
    place the referenced image in the cell to the right of the hyperlink.

    You can run the code from any open workbook...as long as the Convert_HLinks_to_Cell_Pics_v1d.xls file is open.

    Alternatively, you can copy the VBA code from the modProg_1 module into any workbook's VBA module and run it locally.

    Is that something you can work with?
    Attached Files Attached Files
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    09-16-2009
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Attaching Pictures on Excel Spreadsheet using Path from the Cell Value

    Thanks, Ron Coderre for your quick response.

    Unfortunately, the code errors out even on the sample that you provided.

    The error message is as follows:

    Run-time error '-2147024809 (80070057)':
    The item with the specified name wasn't found.

    With ActiveSheet.Shapes(strPicFileName)

    I am unable to run the macro.

    Also, I had a question about the code.

    1. Does the location have to be in hyperlink? All my cell values are not hyperlinks, but has the local folder locations.

    2. What happens if the picture is not in the location? Does it error out and continue? Is there a way for the macro to output text into the cell instead of picture if the picture is not available in the location provided be the cell.

    Once again, thank you for your help.

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Attaching Pictures on Excel Spreadsheet using Path from the Cell Value

    Quote Originally Posted by KrNpRiDe View Post
    Thanks, Ron Coderre for your quick response.

    Unfortunately, the code errors out even on the sample that you provided.

    The error message is as follows:

    Run-time error '-2147024809 (80070057)':
    The item with the specified name wasn't found.

    With ActiveSheet.Shapes(strPicFileName)

    I am unable to run the macro.

    Also, I had a question about the code.

    1. Does the location have to be in hyperlink? All my cell values are not hyperlinks, but has the local folder locations.

    2. What happens if the picture is not in the location? Does it error out and continue? Is there a way for the macro to output text into the cell instead of picture if the picture is not available in the location provided be the cell.

    Once again, thank you for your help.

    1) When downloading the file from this site, I need to save it before running the macro. That may b part of the problem.

    2) The locations must be links, either to files or web locations.

    3) The image file is definitely at the link location. However, if an image is NOT at the location, the macro errors out. The macro can be changed to place a message in the cell for missing images.

    4) I didn't test the macro on XL2007. It may not run on that Excel version. I'll check, but not for a while. I have a class to teach tonight.

  5. #5
    Registered User
    Join Date
    09-16-2009
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Attaching Pictures on Excel Spreadsheet using Path from the Cell Value

    Thank you for the information.

    I will try to test it on Excel 2003 if I can find a computer that has the version.

    As for the saving the file before running the macro, I thought the link was pointing directly to the website? What do you mean download the picture first?

    Also, is there a way to put in hyperlinks to the cell value with a macro?

    The cell value is the location of the picture, but not have the hyperlinks, therefore, would require a macro to put hyperlinks to each value, which would be the same as the cell value.

    Thank you again for your help.

  6. #6
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Attaching Pictures on Excel Spreadsheet using Path from the Cell Value

    1) I meant that after downloading the Excel file I posted, the macro didn't work unless I saved the file to a location on one of my drives.

    2) I'll tweak the macro so it works with pseudo-links and traps errors.
    ...I thought your situation was more straight-forward.

  7. #7
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Attaching Pictures on Excel Spreadsheet using Path from the Cell Value

    I attached and edited XL2007 version that traps errors and
    handles hyperlinks AND non-hyperlink image paths to the internet or file
    server locations. It also posts comments for images that could not be loaded.

    Run the ConvertRefLinksToCellPics macro
    ...not ConvertHLinksToCellPics

    Please let me know how that works for you.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    09-30-2015
    Location
    England
    MS-Off Ver
    2007
    Posts
    1

    Re: Attaching Pictures on Excel Spreadsheet using Path from the Cell Value

    Hi Ron,

    Many thanks for sharing this, it has saved me quite a lot of time!

    Cheers,
    -Ben

  9. #9
    Registered User
    Join Date
    01-13-2017
    Location
    pakistan
    MS-Off Ver
    2007
    Posts
    7

    Re: Attaching Pictures on Excel Spreadsheet using Path from the Cell Value

    i want to insert file path of multiple picture in excel cell. please advised me how i can that...
    For Example.
    A1 is the Cell C:\New\1.Jpg
    A2 C:\New\2.Jpg
    A3 C:\New\3.Jpg
    A4 C:\New\4.Jpg

    i want to import this in corel draw. and in corel draw it is showing file path not the picture.

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Attaching Pictures on Excel Spreadsheet using Path from the Cell Value

    Quote Originally Posted by shahzad1232 View Post
    i want to insert file path of multiple picture in excel cell. please advised me how i can that...
    shahzad1232, please open a new thread to ask your question. Unfortunately your post does not comply with Rule 2 of our Forum Rules. Do not post a question in the thread of another member -- start your own thread.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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