The code below sends out an e-mail through microsoft excel using lotus notes 8 but it does not keep the text formatted. For instance there are headings in the text that i want to be bold but it doesn't keep the bold formatting. I have tried a couple of things but it seems a lot of the things (like htmlbody instead of body) only seem to work with Lotus Notes 7 and not 8. Any help would be greatly appreciated. Or if there is another way to make a form in excel and then have it get sent out (in the correct format) through lotus notes 8, I would like to know.
Lots of googling has lead me to this site because I can't seem to figure it out and neither can anyone (it seems) at my company.
Thanks
Lots of googling has lead me to this site because I can't seem to figure it out and neither can anyone (it seems) at my company.
Thanks
Code:
Sub Picture5_Click()
Dim noSession As Object, noDatabase As Object, noDocument As Object
Dim obAttachment As Object, EmbedObject As Object
Dim stSubject As Variant, stAttachment As String
Dim vaRecipient As Variant, vaMsg As Variant, vaSubject As Variant, vaCopyTo As Variant
Set noSession = CreateObject("Notes.Notessession")
Set noDatabase = noSession.GetDataBase("", "")
'If Lotus Notes is not open then open the mail-part of it.
If noDatabase.IsOpen = False Then noDatabase.OPENMAIL
Set noDocument = noDatabase.CreateDocument
'vaRecipient = Worksheets("Sheet1").Range("D11")
vaRecipient = Split(Range("D11").Value, ",")
vaCopyTo = Split(Range("D16").Value, ",")
vaSubject = Worksheets("Sheet1").Range("D21")
'What was the problem reading
vaMsg = Worksheets("Sheet1").Range("C23") & vbCrLf & Worksheets("Sheet1").Range("C277") & Worksheets("Sheet1").Range("C24")
'Where did the outage.... reading
vaMsg = vaMsg & vbCrLf & vbCrLf & vbCrLf & Worksheets("Sheet1").Range("C31") & vbCrLf & Worksheets("Sheet1").Range("C277") & Worksheets("Sheet1").Range("C32")
'Who was impacted.... reading
vaMsg = vaMsg & vbCrLf & vbCrLf & vbCrLf & Worksheets("Sheet1").Range("C39") & vbCrLf & Worksheets("Sheet1").Range("C277") & Worksheets("Sheet1").Range("C40")
'When did the outage / incident occur.... reading
vaMsg = vaMsg & vbCrLf & vbCrLf & vbCrLf & Worksheets("Sheet1").Range("C47") & vbCrLf & Worksheets("Sheet1").Range("C277") & Worksheets("Sheet1").Range("C48")
'resolution.... reading
vaMsg = vaMsg & vbCrLf & vbCrLf & vbCrLf & Worksheets("Sheet1").Range("C50") & vbCrLf & Worksheets("Sheet1").Range("C277") & Worksheets("Sheet1").Range("C51")
'next steps.... reading
vaMsg = vaMsg & vbCrLf & vbCrLf & vbCrLf & Worksheets("Sheet1").Range("C58") & vbCrLf & Worksheets("Sheet1").Range("C277") & Worksheets("Sheet1").Range("C59")
noDocument.SendTo = vaRecipient
noDocument.CopyTo = vaCopyTo
noDocument.Form = "Memo"
noDocument.SendTo = vaRecipient
noDocument.CopyTo = vaCopyTo
noDocument.Subject = vaSubject
noDocument.body = vaMsg
noDocument.SaveMessageOnSend = True
With noDocument
.PostedDate = Now()
.SEND 0, vaRecipient
End With
Set EmbedObject = Nothing
Set obAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing
'Activate Excel for the user.
AppActivate "Microsoft Excel"
MsgBox "The e-mail has successfully been created and distributed.", vbInformation
End Sub