+ Reply to Thread
Results 1 to 5 of 5

VB code to insert picture when email picture not in excel

  1. #1
    Registered User
    Join Date
    01-25-2013
    Location
    shelby,usa
    MS-Off Ver
    Excel 2010
    Posts
    32

    VB code to insert picture when email picture not in excel

    I have this code and it works great, only thing is when I email or delete the picture from the PC Excel shows the place mark for the picture but shows "The linked image cannot be displayed. The file may have been moved, renamed, or deleted. Verify that the link points to the correct file and location."
    I researched that with Excel 2010 that maybe VB code changed in 2010.

    I can do what the code does below manualy via the menu bar and when emailed or the picture is deleted from the PC is it still in Excel.

    Reasrched this and found a site that mentioned something to the fact that may need something like
    Please Login or Register  to view this content.
    I tried replacing the above code where this is but does not insert picture.
    Please Login or Register  to view this content.
    Thanks in Advance. I have no VB experience
    .
    Please Login or Register  to view this content.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: VB code to insert picture when email picture not in excel

    Hi T_BOLT

    Please explain what it is your trying to do. For example, do you want the Image in the Email Body? Are you Emailing from Outlook through Excel? More information please.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    01-25-2013
    Location
    shelby,usa
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: VB code to insert picture when email picture not in excel

    No image in the email body and not email from within Excel. Just an excel file that could be emailed if needed and the pictures be in the excel file.

    I am wanting a excel file with a button were a person can click on that button and it insert a picture by browsing their PC for the picture file and put that picture in at a cell and resize it and see the picture, preferable not embedded as and icon. Then they can press the button again and insert another picture and place it in the work sheet. Then once all the pictures are in the worksheet be able to email the saved excel file and have the picture still in the worksheet. It appears that what it is doing is inserting a link to the picture on the local computer.

    The co-works seem to have a hard time doing this thru the Excel menu because they cant seem place the picture at a certain spot in the worksheet for the picture, meaning the pictures are all over the worksheet, instead of below the other etc. Also the people have a hard time when they insert the picture and it is 1200 X 1200 pixels they cant seem to resize it to a smaller size yet really maintain the actual resolution of the picture in the worksheet.

    I would like also to on a different worksheet tab basically do the same with a pdf file. If I can get the code for the picture I think I could modify it for the pdf file. The worksheet might have 4 pictures and 1 pdf file one time the next time it may have 6 pictures and 2 pdf files.

    If the above is not possible with 2010 If I could get code to insert "object" by the means of Insert Object > Create From File > Browse and the Link to File or Display as Icon unchecked that will work. I have found code that will just bring up the inset object dialog box but cant get code to bring up the browse window to allow you to browse the PC for the file you want to insert.

    If either way can work, it would be very helpful for co-workers that have a hard time in inserting pictures in excel and have them paced in the worksheet in an orderly fashion and resized so the a small part of the inserted picture will not fill the complete computer screen of worksheet .

    Thanks in advance for any possible help. Hope this helps in what I am trying to accomplish.

    The code works great but if you save the Excel file and then you email the excel file the pictures are not in the worksheet there just an empty box with "The linked image cannot be displayed. The file may have been moved, renamed, or deleted. Verify that the link points to the correct file and location." in the empty box.
    It shows the same thing on the computer if I save the excel file and if I then delete the picture and then reopen the Excel file the pictures are gone.

    Maybe the insert Object is a better approach if I could get it to where the Browse PC for the file to come up, at least that way the picture is embedded and easly clicked on the move around the work sheet. They would just have to double click to see the actual picture.
    Last edited by T_BOLT; 04-06-2014 at 02:20 PM.

  4. #4
    Registered User
    Join Date
    01-25-2013
    Location
    shelby,usa
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: VB code to insert picture when email picture not in excel

    I found an alternative to have excel insert the picture (showing picture is preferred) in the worksheet. I found some code to insert the picture as an object. I adjusted to have the cell selected once browsed for the file.

    I can use this code below but is it possible once the file is inserted have a message box come up to be able to change the name? It shows e.g. 2012-08-31_06-57-22_792.jpg (see picture) but would like to be able to change it to e.g.. Storm Damage 1.jpg?

    \1

    Please Login or Register  to view this content.
    Attached Images Attached Images

  5. #5
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: VB code to insert picture when email picture not in excel

    Hi,

    I suggest (albeit after a very rapid read of your post) that you look at the Ron de Bruin website and in particular the email with envelope option, emailing spreadsheet pages with images is a problem but Ron's code seems to handle it reasonably well

    Cheers

    Jmac1947

    1. Please consider clicking on the * Add Reputation if you think this post has helped you
    2. Mark your thread as SOLVED when question is resolved

+ 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. VBA for Picture insert at particular worksheet range. Picture name derived from cell.
    By Douglas2013 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2013, 01:16 AM
  2. Creating macro to insert a picture by including specific picture name & path
    By NissaFrenchRamsteyn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-09-2012, 05:40 AM
  3. [SOLVED] macro: insert picture based on workbook location, not picture root path.
    By NicksDad in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-03-2012, 07:47 AM
  4. Can I insert a picture into an email
    By joe41 in forum Outlook Formatting & Functions
    Replies: 1
    Last Post: 03-25-2009, 04:55 AM
  5. insert picture in email message
    By H.A. de Wilde in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-01-2006, 03:42 AM

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