Felipe Donato
New Member
- Joined
- Nov 6, 2019
- Messages
- 1
Dear all,
I am a beginner in VBA and I am enjoying a lot how it can help me in my activities. My company uses Lotus Notes, and I am trying to use the code below to send automatically emails using Excell/VBA and Lotus Notes. But the problem is that I don't know how to format the text of the email. I would like to Bold and underlines some words but I could not find a way. I have tried to add
"set notes Set notesField = notesDocument.CreateRichTextStyle" and ".AppendStyle=Bold" ,
but the error informs that miss an object.
The other way that I saw it is try to MIME HTML, but I also could not find a way.
The code is below, if someone can help me I would appreciate a lot, and if it is possible to send me some good references for my studying.
Thank you all a lot:
I am a beginner in VBA and I am enjoying a lot how it can help me in my activities. My company uses Lotus Notes, and I am trying to use the code below to send automatically emails using Excell/VBA and Lotus Notes. But the problem is that I don't know how to format the text of the email. I would like to Bold and underlines some words but I could not find a way. I have tried to add
"set notes Set notesField = notesDocument.CreateRichTextStyle" and ".AppendStyle=Bold" ,
but the error informs that miss an object.
The other way that I saw it is try to MIME HTML, but I also could not find a way.
The code is below, if someone can help me I would appreciate a lot, and if it is possible to send me some good references for my studying.
Thank you all a lot:
HTML:
Sub EnviarEmailViaNotes()
Dim notesSession As Object
Dim notesMailFile As Object
Dim notesDocument As Object
Dim notesField As Object
Dim receptores(2) As Variant
'Cria Uma lista de destinatários
receptores(0) = "XXXXX"
receptores(1) = "XXXXX"
Set notesSession = CreateObject("Notes.NotesSession")
Set notesMailFile = notesSession.GetDataBase("", "names.nsf") '- *.nsf = arq. com lista de contatos
Set notesDocument = notesMailFile.CreateDocument
Set notesField = notesDocument.AppendItemValue("Subject", "Teste de Envio via Excel...")
Set notesField = notesDocument.AppendItemValue("SendTo", receptores)
Set notesField = notesDocument.CreateRichTextItem("Body")
With notesField
.AppendText "Este é um modelo que copiei da ferramenta, "
.AddNewLine (2)
.AppendText "Para um possível uso no arquivo do GSAM. "
.AddNewLine (1)
.AppendText "Chegou? Tudo Certo?"
.AddNewLine (3)
.AppendText Cells(1, 1).Value
End With
notesDocument.Send False
Set notesSession = Nothing
Set notesMailFile = Nothing
Set notesDocument = Nothing
Set notesField = Nothing
End Sub