Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default How to include Excel charts in Outlook email *body* with VB

Hello

Is it possible to cut and paste a regular Excel chart into an Outlook
email *body* with VBA?

I have all the code for sending emails from http://www.rondebruin.nl/mail/folder2/chart.htm
but what is missing is the option of how to include the charts in the
*body* of the generated email. Ron's example shows how to attach a GIF
file.

Does anyone know how to do this? My audience want to see the charts
immediatley in the email body.

Thanks in advance,
Chrisso
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default How to include Excel charts in Outlook email *body* with VB

Hi Chrisso

See
http://www.rondebruin.nl/mail/folder3/mailenvelope.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Chrisso" wrote in message ...
Hello

Is it possible to cut and paste a regular Excel chart into an Outlook
email *body* with VBA?

I have all the code for sending emails from http://www.rondebruin.nl/mail/folder2/chart.htm
but what is missing is the option of how to include the charts in the
*body* of the generated email. Ron's example shows how to attach a GIF
file.

Does anyone know how to do this? My audience want to see the charts
immediatley in the email body.

Thanks in advance,
Chrisso

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default How to include Excel charts in Outlook email *body* with VB

Hi Ron,

In your MailEnvelope example, in your link below, I found if changed
Dim Sendrng As Range
to
Dim Sendrng As Object
Set Sendrng = Selection

If I selected a chartarea, it worked fine. However it failed if I tried to
do any of the following

Set Sendrng = ActiveSheet.Chartobjects(1)
Set Sendrng = ActiveSheet.Chartobjects(1).Chart
Set Sendrng = ActiveSheet.Chartobjects(1).Chart.ChartArea


In your "SaveSend_Embedded_Chart" as refered to by Chrisso here
http://www.rondebruin.nl/mail/folder2/chart.htm
the following change worked for me

change
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add Fname
.Send 'or use .Display
End With

to
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
' Fname = "C:\My_Sales1.gif" defined earlier
s = "<pHi there<p"
s = s & "<p<img src=file://" & Fname & "</p"
s = s & "Bye"
s = "<HTML<BODY" & s & "<HTML<BODY"
.HTMLBody = s
.Send 'or use .Display
End With

Regards,
Peter T



"Ron de Bruin" wrote in message
...
Hi Chrisso

See
http://www.rondebruin.nl/mail/folder3/mailenvelope.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Chrisso" wrote in message
...
Hello

Is it possible to cut and paste a regular Excel chart into an Outlook
email *body* with VBA?

I have all the code for sending emails from
http://www.rondebruin.nl/mail/folder2/chart.htm
but what is missing is the option of how to include the charts in the
*body* of the generated email. Ron's example shows how to attach a GIF
file.

Does anyone know how to do this? My audience want to see the charts
immediatley in the email body.

Thanks in advance,
Chrisso



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default How to include Excel charts in Outlook email *body* with VB

Hi Peter

You can also use this

Activate the chart you want to send in the code
ActiveSheet.ChartObjects("Grafiek 1").Activate


Sub Send_Chart_with_MailEnvelope()
On Error GoTo StopMacro

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

ActiveSheet.ChartObjects("Grafiek 1").Activate

'Create the mail and send it

ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope

' Set the optional introduction field thats adds
' some header text to the email body.
.Introduction = "This is a test mail."

' In the "With .Item" part you can add more options
' See the tips on this Outlook example page.
' http://www.rondebruin.nl/mail/tips2.htm
With .Item
.To = "
.Subject = "My subject"
.Send
End With

End With

StopMacro:
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
ActiveWorkbook.EnvelopeVisible = False

End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Peter T" <peter-t@discussions wrote in message ...
Hi Ron,

In your MailEnvelope example, in your link below, I found if changed
Dim Sendrng As Range
to
Dim Sendrng As Object
Set Sendrng = Selection

If I selected a chartarea, it worked fine. However it failed if I tried to
do any of the following

Set Sendrng = ActiveSheet.Chartobjects(1)
Set Sendrng = ActiveSheet.Chartobjects(1).Chart
Set Sendrng = ActiveSheet.Chartobjects(1).Chart.ChartArea


In your "SaveSend_Embedded_Chart" as refered to by Chrisso here
http://www.rondebruin.nl/mail/folder2/chart.htm
the following change worked for me

change
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add Fname
.Send 'or use .Display
End With

to
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
' Fname = "C:\My_Sales1.gif" defined earlier
s = "<pHi there<p"
s = s & "<p<img src=file://" & Fname & "</p"
s = s & "Bye"
s = "<HTML<BODY" & s & "<HTML<BODY"
.HTMLBody = s
.Send 'or use .Display
End With

Regards,
Peter T



"Ron de Bruin" wrote in message
...
Hi Chrisso

See
http://www.rondebruin.nl/mail/folder3/mailenvelope.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Chrisso" wrote in message
...
Hello

Is it possible to cut and paste a regular Excel chart into an Outlook
email *body* with VBA?

I have all the code for sending emails from
http://www.rondebruin.nl/mail/folder2/chart.htm
but what is missing is the option of how to include the charts in the
*body* of the generated email. Ron's example shows how to attach a GIF
file.

Does anyone know how to do this? My audience want to see the charts
immediatley in the email body.

Thanks in advance,
Chrisso



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default How to include Excel charts in Outlook email *body* with VB

Btw: this is not working anymore in Excel 2007

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Ron de Bruin" wrote in message .. .
Hi Peter

You can also use this

Activate the chart you want to send in the code
ActiveSheet.ChartObjects("Grafiek 1").Activate


Sub Send_Chart_with_MailEnvelope()
On Error GoTo StopMacro

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

ActiveSheet.ChartObjects("Grafiek 1").Activate

'Create the mail and send it

ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope

' Set the optional introduction field thats adds
' some header text to the email body.
.Introduction = "This is a test mail."

' In the "With .Item" part you can add more options
' See the tips on this Outlook example page.
' http://www.rondebruin.nl/mail/tips2.htm
With .Item
.To = "
.Subject = "My subject"
.Send
End With

End With

StopMacro:
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
ActiveWorkbook.EnvelopeVisible = False

End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Peter T" <peter-t@discussions wrote in message ...
Hi Ron,

In your MailEnvelope example, in your link below, I found if changed
Dim Sendrng As Range
to
Dim Sendrng As Object
Set Sendrng = Selection

If I selected a chartarea, it worked fine. However it failed if I tried to
do any of the following

Set Sendrng = ActiveSheet.Chartobjects(1)
Set Sendrng = ActiveSheet.Chartobjects(1).Chart
Set Sendrng = ActiveSheet.Chartobjects(1).Chart.ChartArea


In your "SaveSend_Embedded_Chart" as refered to by Chrisso here
http://www.rondebruin.nl/mail/folder2/chart.htm
the following change worked for me

change
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add Fname
.Send 'or use .Display
End With

to
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
' Fname = "C:\My_Sales1.gif" defined earlier
s = "<pHi there<p"
s = s & "<p<img src=file://" & Fname & "</p"
s = s & "Bye"
s = "<HTML<BODY" & s & "<HTML<BODY"
.HTMLBody = s
.Send 'or use .Display
End With

Regards,
Peter T



"Ron de Bruin" wrote in message
...
Hi Chrisso

See
http://www.rondebruin.nl/mail/folder3/mailenvelope.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Chrisso" wrote in message
...
Hello

Is it possible to cut and paste a regular Excel chart into an Outlook
email *body* with VBA?

I have all the code for sending emails from
http://www.rondebruin.nl/mail/folder2/chart.htm
but what is missing is the option of how to include the charts in the
*body* of the generated email. Ron's example shows how to attach a GIF
file.

Does anyone know how to do this? My audience want to see the charts
immediatley in the email body.

Thanks in advance,
Chrisso





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default How to include Excel charts in Outlook email *body* with VB

"Ron de Bruin" wrote in message
Btw: this is not working anymore in Excel 2007


It (MailEnvelope) doesn't work in Excel 2000 either. XP?

Regards,
Peter T


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default How to include Excel charts in Outlook email *body* with VB

Looks like "Send_Chart_with_MailEnvelope" is one of those few operations
that requires code to "select" something, in this case the chart.

In my previous post, in an 'ordinary' message I mentioned something like the
following works

s = s & "<p<img src=file://" & Fname & "</p"
s = "<HTML<BODY" & s & "<HTML<BODY"
.HTMLBody = s

however I forgot to say that the file, Fname, must remain on the disk, so
when done don't do
Kill Fname

Regards,
Peter T


"Ron de Bruin" wrote in message
.. .
Hi Peter

You can also use this

Activate the chart you want to send in the code
ActiveSheet.ChartObjects("Grafiek 1").Activate


Sub Send_Chart_with_MailEnvelope()
On Error GoTo StopMacro

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

ActiveSheet.ChartObjects("Grafiek 1").Activate

'Create the mail and send it

ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope

' Set the optional introduction field thats adds
' some header text to the email body.
.Introduction = "This is a test mail."

' In the "With .Item" part you can add more options
' See the tips on this Outlook example page.
' http://www.rondebruin.nl/mail/tips2.htm
With .Item
.To = "
.Subject = "My subject"
.Send
End With

End With

StopMacro:
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
ActiveWorkbook.EnvelopeVisible = False

End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Peter T" <peter-t@discussions wrote in message
...
Hi Ron,

In your MailEnvelope example, in your link below, I found if changed
Dim Sendrng As Range
to
Dim Sendrng As Object
Set Sendrng = Selection

If I selected a chartarea, it worked fine. However it failed if I tried
to do any of the following

Set Sendrng = ActiveSheet.Chartobjects(1)
Set Sendrng = ActiveSheet.Chartobjects(1).Chart
Set Sendrng = ActiveSheet.Chartobjects(1).Chart.ChartArea


In your "SaveSend_Embedded_Chart" as refered to by Chrisso here
http://www.rondebruin.nl/mail/folder2/chart.htm
the following change worked for me

change
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add Fname
.Send 'or use .Display
End With

to
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
' Fname = "C:\My_Sales1.gif" defined earlier
s = "<pHi there<p"
s = s & "<p<img src=file://" & Fname & "</p"
s = s & "Bye"
s = "<HTML<BODY" & s & "<HTML<BODY"
.HTMLBody = s
.Send 'or use .Display
End With

Regards,
Peter T



"Ron de Bruin" wrote in message
...
Hi Chrisso

See
http://www.rondebruin.nl/mail/folder3/mailenvelope.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Chrisso" wrote in message
...
Hello

Is it possible to cut and paste a regular Excel chart into an Outlook
email *body* with VBA?

I have all the code for sending emails from
http://www.rondebruin.nl/mail/folder2/chart.htm
but what is missing is the option of how to include the charts in the
*body* of the generated email. Ron's example shows how to attach a GIF
file.

Does anyone know how to do this? My audience want to see the charts
immediatley in the email body.

Thanks in advance,
Chrisso



Reply
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
Send a Sheet as body of Outlook Email David Ackerman on cape cod Excel Discussion (Misc queries) 0 March 19th 10 03:11 PM
Outlook email url in body kevinho[_3_] Excel Programming 2 August 26th 05 12:48 PM
body of email disappears when I send an email from Excel ~A Excel Discussion (Misc queries) 0 February 25th 05 10:55 PM
Late Binding to Outlook from Excel: Outlook modifies email body Lenny Wintfeld Excel Programming 0 December 12th 04 04:03 PM
How to paste cells from Excel into Outlook email body? stastim Excel Programming 2 August 23rd 04 06:35 PM


All times are GMT +1. The time now is 12:41 PM.

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"