Sending Mails via Notes 9 using VBA

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

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

Subject: Did you regsvr32 nlsxbe32.dll?

http://www-01.ibm.com/support/docview.wss?uid=swg21112239 http://www-01.ibm.com/support/docview.wss?uid=swg21112239