Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() hello and thank you in advance for your help. i'm trying to get a small number chart from a spreadsheet to the body of an email (using .htmlbody=) by simply running a macro. i've currently got the code working so far to save each chart as a jpg. the problem i'm having is that when my charts save into the temp folder, when i run the macro again, the charts do not update in the new email. i'm using the following chunk of code for the charts to email macro: -------------------------------------------------------------------------------------------- Worksheets("Charts").Activate Fname1 = Environ$("temp") & "\Chart1.jpg" ActiveWorkbook.Worksheets("Charts").ChartObjects(" Chart 1").Chart.Export _ Filename:=Fname1, FilterName:="JPG" Fname2 = Environ$("temp") & "\Chart2.JPG" ActiveWorkbook.Worksheets("Charts").ChartObjects(" Chart 2").Chart.Export _ Filename:=Fname2, FilterName:="JPG" Fname3 = Environ$("temp") & "\Chart3.JPG" ActiveWorkbook.Worksheets("Charts").ChartObjects(" Chart 3").Chart.Export _ Filename:=Fname3, FilterName:="JPG" 'to allow enough time for the jpgs to process Application.Wait (Now + TimeValue("00:00:03")) s1 = "<p<img src=file://" & Fname1 & "</p<br" s2 = "<p<img src=file://" & Fname2 & "</p<br" s3 = "<p<img src=file://" & Fname3 & "</p<br" On Error Resume Next With OutMail .Recipients.Add sRecipient .Subject = "Charts Report" '.HTMLBody = "The following is the recent history of files:<br<br" _ & s1 & s2 & s3 & "<br<br<br<br" Thanks! Application.Wait (Now + TimeValue("00:00:03")) .Display End With ---------------------------------------------------------------------------------------------- the code seems right... the charts populate in my email just as they should, but the data in them isnt correctly updating. the odd thing i've noticed... is that when i restart my computer and run the code, they actually update correctly for the first run right after restart... then from there, regardless of how many times i run the macro, the charts remain the same. i've tried changing up the number in the worksheet just to test the updating of the charts, but still nothing. any suggestions? :-\ -- Oh, the creative possibilities! ^_^ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using Macro how to create email link for the email addresses in aRange or Selection | Excel Worksheet Functions | |||
Excel VBA macro to send email attachment from default email client | Excel Programming | |||
email out Pivot Chart with one record only | Excel Programming | |||
email chart | Excel Programming | |||
Email a chart from excel via Lotus Notes | Excel Programming |