1. how can i send the mail to several recipients?
2. when i save the full path name, i must put a .xls at the end of the
file name or else i can't open it with lotus notes (notes dosen't
recognizes the file). Is it possible to save the file as an excel
format without righting the .xls extension?
' be sure to reference the Lotus Domino Objects, domobj.tlb
Dim objNotesSession As Object
Dim objNotesDatabase As Object
Dim objNotesDocument As Object
Dim objAttachment As Object
Dim objRichText As Object
Dim FullPath As String
Dim FileName As String
Dim Msg As String
Const EMBED_ATTACHMENT = 1454
Set objNotesSession = CreateObject("Notes.Notessession")
Set objNotesDatabase = objNotesSession.GETDATABASE("", "")
Call objNotesDatabase.OpenMail 'default mail database
If objNotesDatabase.IsOpen = False Then
MsgBox "Cannot connect to Lotus Notes."
Exit Sub
End If
Set objNotesDocument = objNotesDatabase.CreateDocument
Call objNotesDocument.ReplaceItemValue("Form", "Memo")
Sheets("COMISSÕES").Select
ActiveSheet.Copy
FullPath = Application.GetSaveAsFilename
ActiveWorkbook.SaveAs FullPath
FileName = ActiveWorkbook.Name
' assemble message
Set objRichText = objNotesDocument.CreateRichTextItem("Body")
Set objAttachment = objRichText.EmbedObject(EMBED_ATTACHMENT, "",
FullPath, FileName)
Msg = "Lotus Note sent from " & objNotesSession.CommonUserName
With objNotesDocument
.Subject = "Excel Lotus Note!"
.Body = Msg
.sendto = "cristina...@gfs.pt"
.SaveMessageOnSend = True ' save in Sent folder
.send (False)
End With
Set objNotesSession = Nothing
Set objNotesDatabase = Nothing
Set objNotesDocument = Nothing
Set objAttachment = Nothing
Set objRichText = Nothing
MsgBox "Your Lotus Notes message was successfully sent"
ActiveWorkbook.Close