Automatic Signature not appending in Lotus when email generated via VBA
Posted on 2007-07-31
Very new to VBA but from scanning the net and this forum I can't seem to find an answer to my problem(s).
I'm generating an email from Excel to Lotus notes with an attachment. I can generate the email fine enough but my automatic signature does not append??? Is this because part of the signature file (picture) is html??
Also I was wondering if there is a way to append my exel file into the body of the email as opposed to embeding it in the memo itself?
Current code thus far
Dim Attachment As String
Dim ReinstatementRecipient As String
Dim ReinstatementSubject As String
Dim Msg As String
Dim NotesSession as Object
Dim NotesDatabase As Object
Dim NotesDocument As Object
Dim NotesAttachment As Object
Dim EmbedObj As Object
ReinstatementRecipient = InputBox("Enter the Customers email address", "Email Address")
ReinstatementSubject = "Reinstatement Form"
Body = "body text"
'Instantiate the Lotus Notes Objects.
Set notessession = CreateObject("Notes.NotesSession")
Set NotesDatabase = notessession.GETDATABASE("", "")
'If Lotus Notes is not open then open the mail-part of it.
If NotesDatabase.IsOpen = False Then NotesDatabase.OPENMAIL
'Create the e-mail & the attachment
Set NotesDocument = NotesDatabase.CREATEDOCUMENT
Set NotesAttachment = NotesDocument.CREATERICHTEXTITEM("Attachment")
Set EmbedObj = NotesAttachment.EmbedObject(1454, "", "\\filwlg02\InternetChan\IOLB\Fraud Reporting\Forms\Reinstatement Form.doc", "Attachment")
'Add values to the created e-mail main properties.
.Form = "Memo"
.SendTo = ReinstatementRecipient
.Subject = Subject
.Body = Msg
.SaveMessageOnSend = True
'Send the e-mail.
.PostedDate = Now()
.Send 0, Recipient
'Release objects from the memory.
Set NotesDocument = Nothing
Set NotesDatabase = Nothing
Set NotesSession = Nothing
Set EmbedObj = Nothing
Set NotesAttachment = Nothing
'Activate Excel for the user.
AppActivate "Microsoft Excel"
MsgBox "The e-mail has been sent successfully.", vbInformation