Email a chart from excel via Lotus Notes



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
'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",
Call stream.Close
Call doc.Save(True, True)
Call doc.Send(False)
s.ConvertMime = True ' Restore conversion
End Sub

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question