View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Email a chart from excel via Lotus Notes

Maybe you can use a part of this macro for Outlook
http://www.rondebruin.nl/mail/folder2/chart.htm


--

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


wrote in message oups.com...
I wanted to email a chart from excel via Lotus Notes and it is easy to
set up using the uidocument process in Lotus Notes. However I have not
found a way of closing the uidocument from vba. This code is a way
around the problem because it does not involve uidocument.

ActiveSheet.ChartObjects("Chart 122").Activate
ActiveChart.ChartArea.Select
'ActiveSheet.ChartObjects("chart 122").Select
strGIFFileName = "d:\graff1.gif"
Selection.Parent.Export Filename:=strGIFFileName
Set s = CreateObject("Notes.NotesSession")
Set db = s.GetDatabase("", "d:\notes\dgb1.nsf")
Set stream = s.CreateStream
s.ConvertMime = False
Set doc = db.CreateDocument
Set body = doc.CreateMIMEEntity
Set header = body.CreateHeader("Subject")
Call header.SetHeaderVal("Subject......")
Set header = body.CreateHeader("To")
Call header.SetHeaderVal("address.....")
Set stream = s.CreateStream
If Not stream.Open("D:\graff1.gif", "binary") Then
GoTo ExitSub
End If
If stream.Bytes = 0 Then GoTo ExitSub
End If
Call body.SetContentFromBytes(stream, "image/gif",
ENC_IDENTITY_BINARY)
Call stream.Close
Call doc.Save(True, True)
Call doc.Send(False)
ExitSub:
s.ConvertMime = True ' Restore conversion
End Sub