LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
KBL KBL is offline
external usenet poster
 
Posts: 3
Default chart to email


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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Macro how to create email link for the email addresses in aRange or Selection Satish[_2_] Excel Worksheet Functions 8 December 28th 09 03:30 PM
Excel VBA macro to send email attachment from default email client wifigoo Excel Programming 2 April 12th 08 03:54 PM
email out Pivot Chart with one record only QuocAnh[_2_] Excel Programming 5 October 30th 07 07:02 AM
email chart John Excel Programming 1 July 11th 07 08:31 PM
Email a chart from excel via Lotus Notes [email protected] Excel Programming 1 February 8th 07 10:32 PM


All times are GMT +1. The time now is 09:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"