Automatically email using lotus Notes - How to Format text

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:
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
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,223,702
Messages
6,173,969
Members
452,539
Latest member
delvey

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top