+ Reply to Thread
Results 1 to 20 of 20

Problem with copying charts into html body outlook

  1. #1
    Registered User
    Join Date
    12-12-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2003
    Posts
    9

    Problem with copying charts into html body outlook

    Hello

    I am attempting to copy one active sheet into html body outlook message.

    I have the following code, which is adding the attachments however my charts still do not appear.

    I am attempting to add one chart for now, but once complete will need to add all 5 from the page.

    Any help with the code would be much, much appreciated.

    Thank you


    Please Login or Register  to view this content.
    Last edited by katekatebobs; 12-12-2013 at 08:54 AM. Reason: TO COMPLY WITH RULES

  2. #2
    Forum Moderator Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,403

    Re: Problem with copying charst into html body outlook

    Hi and welcome to the forum. Unfortunately your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Richard Buttrey

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    12-12-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Problem with copying charst into html body outlook

    okay all done any chance of some help now please?

  4. #4
    Forum Moderator Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,403

    Re: Problem with copying charst into html body outlook

    Hi,

    Here's a section of code which I use to do this sort of thing.
    The general idea is to create an empty 'chart' area that contains the stuff you want to put in the body of the email and create a temporary file that contains a picture of that area. Then use the temporary file name in the .htmlbody section of the Outlook email definition.



    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-12-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Problem with copying charst into html body outlook

    Hi Richard

    Thank you so much for your response

    It is a lot more clear cut that other stuff I have been advised to do

    However, I am having a problem with the following code line

    Please Login or Register  to view this content.
    I have changed to

    Please Login or Register  to view this content.
    Where EMAILSHEET is the sheet where my range of data plus charts is, and EMAIL_RANGE is the whole print area I would like to see in the html outlook message

    I am getting run time error 424 'object required'

    Again thank you for any insight

  6. #6
    Registered User
    Join Date
    12-12-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Problem with copying charst into html body outlook

    I figured it out

    I was being an idiot

    Thank you so much Richard!!!!!!!!!!!!!!!!!!!!!!!

  7. #7
    Registered User
    Join Date
    12-12-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Problem with copying charst into html body outlook

    okay so this is working however missing off three charts at the bottom, the full box is there yet only half of the sheet is showing

    Any ideas why this may be ?

    Thank you

  8. #8
    Forum Moderator Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,403

    Re: Problem with copying charst into html body outlook

    Hi,

    I suspect your named range "email_range" is not in the sheet code name "emailsheet".

    Since it is a named range and which is presumably meant to apply to single sheet try removing the reference to emailsheet and just use the range name.

    Or modify the sheet name to that which contains the email_range

  9. #9
    Registered User
    Join Date
    12-12-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Problem with copying charst into html body outlook

    Okay thank you, have done so and it appears to work on the .display message, the full image displays with all of the range.

    However when I change .display to .send I get a blank email in gmail and a box with a red cross in outlook.

    So confused

    Thank you

  10. #10
    Registered User
    Join Date
    12-12-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Problem with copying charst into html body outlook

    here is my code

    Please Login or Register  to view this content.

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,620

    Re: Problem with copying charst into html body outlook

    As far as I know you need to attach any images you want to include in the email if you want the recipient to see them.

    If you have an image tag with the src path pointing to a local address on your computer then it's pretty unlikely the recipient will be able to access it.

    I suppose if you were working on a network, saving the images to a shared drive then using the UNC path for the src might work.

    How exactly did the original code not work?
    Last edited by Norie; 12-12-2013 at 11:43 AM.
    If posting code please use code tags, see here.

  12. #12
    Registered User
    Join Date
    12-12-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Problem with copying charst into html body outlook

    original code displayed an image however only half of the range was showing - however it still did not send

    I changed to .gif and this made it work

    Back to the drawing board I guess

    Thank you

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,620

    Re: Problem with copying charst into html body outlook

    So the problem with the original code was to do with the range and not the chart?

    Does it work for the range on it's own?

  14. #14
    Forum Moderator Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,403

    Re: Problem with copying charst into html body outlook

    Ah, OK

    I think the problem with my original code is the Kill instruction. At the time the email is sent the file has already been deleted seemingly and the picture is not embedded You then get the red cross place marker.

    Even introducing a wait of several seconds doesn't seem to overcome this. Leaving this instruction out sends the email as expected with the embedded picture.

    However if as you say your code does not include the Kill instruction I'm puzzled since the routine works fine for - admittedly not on a network.

  15. #15
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,620

    Re: Problem with copying charst into html body outlook

    Richard

    When someone receives the email can they see the chart/image?

  16. #16
    Forum Moderator Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,403

    Re: Problem with copying charst into html body outlook

    Hi Norie,

    Yes, but they need to be on the same network.

  17. #17
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,620

    Re: Problem with copying charst into html body outlook

    katekatebobs

    Does it work if you add the image before the data?
    Please Login or Register  to view this content.

  18. #18
    Forum Moderator Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,403

    Re: Problem with copying charst into html body outlook

    Hi,

    Here's another method taken from Ron de Bruin's pages which does seem to work fine.
    Interestingly it's one of the few occasions when it's necessary to use the .Select instruction. Just using
    Set sndRange = Range("myRange")
    which would be the natural thing to do.
    sends the email but with the whole sheet embedded.



    Please Login or Register  to view this content.

  19. #19
    Registered User
    Join Date
    12-12-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Problem with copying charst into html body outlook

    Hi Norie, no, I have been sending to my GMAIL account, and all I get is a blue line, the background colour of my email sheet is blue.

    However, when I leave the code as .display it works fine. It is only when it is sent through.

    Here is the current code, which again displays the full range in the .display code, yet when I change this to .send and open the mail in outlook/gmail, there is just a line.

    Please Login or Register  to view this content.

  20. #20
    Forum Moderator Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,403

    Re: Problem with copying charst into html body outlook

    Hi,

    Is the pict1.gif file in the C:\Temp folder?

+ 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. Conditional formatting not copying over correctly into body of HTML email
    By seaottr in forum Excel Programming / VBA / Macros
    Replies: 29
    Last Post: 04-10-2017, 01:01 PM
  2. Looping through Filter and then copying the data so I can paste or put into outlook body
    By Josh_123456 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-28-2016, 12:12 AM
  3. Macro to copy charts and data from excel to outlook body
    By aspirant in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-22-2013, 03:51 AM
  4. Send e-mail with image on body (.html) on e-mail manager <> outlook
    By mariotnc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-05-2012, 09:28 PM
  5. Copying Excel worksheet in Outlook email body
    By xatomicx in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-30-2010, 01:38 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