This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal


Feb 28, 2018, 4:42 AM
3 Posts

Sending Mails via Notes 9 using VBA

  • Category: Mail
  • Platform: Windows
  • Release: 9.0.1
  • Role:
  • Tags: Notes 9,Notes 9.0.1
  • Replies: 2

I wrote this, which works on Notes 8.0, but it doesn't work on Lotus Notes 9.0 and 9.0.1. (It, highlights the NSession = CreateObject("Notes.NotesSession")

Sub Notes_Email()
Dim NSession As Object
Dim NDatabase As Object
Dim NUIWorkSpace As Object
Dim NDoc As Object, Username As String, MaildbName As String
Dim NUIdoc As Object
Dim Maildb As Object
Dim count As Long
Dim j As Long
j = 1
count = 1

Set NSession = CreateObject("Notes.NotesSession")
Username = NSession.Username
MaildbName = Left$(Username, 1) & Right$(Username, (Len(Username) - InStr(1, Username, " "))) & ".nsf"
Set NDatabase = NSession.GETDATABASE("", "MaildbName")
Set NUIWorkSpace = CreateObject("Notes.NotesUIWorkspace")

If NDatabase.IsOpen = True Then
Else
    NDatabase.OPENMAIL
End If

'Create a new document

Set NDoc = NDatabase.CreateDocument

While (Len(Range("a" & count).Value) > 0)
        count = count + 1
Wend
       
While (Len(Range("d" & j).Value) > 0)
        j = j + 1
Wend
       
With NDoc
    .sendTo = Range("c2:c" & count - 1).Value
    .CopyTo = Range("d2:d" & j - 1).Value
    .subject = "à»Ô´ÍèÒ¹ : KIKO,BullP ¨èÒ´͡àºÕé / ¤Ãº¡Ó˹´ / ¤×¹à»ç¹ËØé¹ËÃ×Íà§Ô¹ Çѹ·Õè XX ¡ØÁÀҾѹ¸ì 2561"

    'Email body text, including marker text which will be replaced by the Excel cells

    Set NotesRichTextItem = .CREATERICHTEXTITEM("Body")
    NotesRichTextItem.APPENDTEXT ("äÎäÅ·ìÊÕà¢ÕÂÇ = Knock out")
    NotesRichTextItem.AddNewline (2)
    NotesRichTextItem.APPENDTEXT ("äÎäÅ·ìÊÕªÁ¾Ù = Knock in")
    NotesRichTextItem.AddNewline (2)
    NotesRichTextItem.APPENDTEXT ("µÑÇÍÑ¡ÉÃÊÕ¿éÒ = ¤Ãº¡Ó˹´ä´éà§Ô¹¤×¹")
    NotesRichTextItem.AddNewline (2)
    NotesRichTextItem.APPENDTEXT ("µÑÇÍÑ¡ÉÃÊÕÊéÁ = ä´éÃѺ¤×¹à»ç¹ËØé¹")
    NotesRichTextItem.AddNewline (1)


'And here comes the attachment:
Call NotesRichTextItem.EMBEDOBJECT(EMBED_ATTACHMENT, "", "File path")


    .Save True, False
End With

'Set NUIdoc = NUIWorkSpace.EditDocument(True, NDoc)

'With NUIdoc

    'Find the marker text in the Body item

'    .gotofield ("Body")
'End With

Set NSession = Nothing
Set Maildb = Nothing
Set Maildb = Nothing
'Set NUIdoc = Nothing

End Sub

Feb 28, 2018, 2:37 PM
326 Posts
regsvr32

try doing a regsvr32 NLSXBE.dll  from a command prompt change directory  to the notes program directory if it is not in the path


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal