Maria Clara
New Member
Hello All, I'm utilizing the code below to send e-mail in Notes via VBA but when the user's signature is on html format I get the error below instead of the person's signature? Can anyone shed any light on that? Thank you!
C:notesdatafooter2.htm
""
Sub SendEmail()
Application.ScreenUpdating = False
Dim UserName As String
Dim MailDbName As String
Dim Recipient As Variant
Dim Maildb As Object
Dim MailDoc As Object
Dim AttachME As Object
Dim Session As Object
Dim stSignature As String
Dim Attachment As String
Dim EmbedObj As Object 'The embedded object (Attachment)
With Application
.ScreenUpdating = False
.DisplayAlerts = False
' Open and locate current LOTUS NOTES User
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set Maildb = Session.GETDATABASE("", MailDbName)
If Maildb.IsOpen = True Then
Else
Maildb.OPENMAIL
End If
' Create New Mail and Address Title Handlers
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
stSignature = Maildb.GETPROFILEDOCUMENT("CalendarProfile").GETITEMVALUE("Signature")(0)
' Select range of e-mail addresses
MailDoc.sendto = "e-mail"
MailDoc.Subject = "TEST"
MailDoc.Body = "TEST." & vbCrLf & vbCrLf & stSignature
MailDoc.SAVEMESSAGEONSEND = True
Set AttachME = MailDoc.CREATERICHTEXTITEM("location")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "Attachment", "location")
MailDoc.PostedDate = Now()
'On Error GoTo errorhandler1
MailDoc.SEND 0, Recipient
Set Maildb = Nothing
Set MailDoc = Nothing
Set Session = Nothing
.ScreenUpdating = True
.DisplayAlerts = True
'errorhandler1:
'
'Set Maildb = Nothing
'Set MailDoc = Nothing
'Set Session = Nothing
'End If
'Next x
End With
End Sub
""
C:notesdatafooter2.htm
""
Sub SendEmail()
Application.ScreenUpdating = False
Dim UserName As String
Dim MailDbName As String
Dim Recipient As Variant
Dim Maildb As Object
Dim MailDoc As Object
Dim AttachME As Object
Dim Session As Object
Dim stSignature As String
Dim Attachment As String
Dim EmbedObj As Object 'The embedded object (Attachment)
With Application
.ScreenUpdating = False
.DisplayAlerts = False
' Open and locate current LOTUS NOTES User
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set Maildb = Session.GETDATABASE("", MailDbName)
If Maildb.IsOpen = True Then
Else
Maildb.OPENMAIL
End If
' Create New Mail and Address Title Handlers
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
stSignature = Maildb.GETPROFILEDOCUMENT("CalendarProfile").GETITEMVALUE("Signature")(0)
' Select range of e-mail addresses
MailDoc.sendto = "e-mail"
MailDoc.Subject = "TEST"
MailDoc.Body = "TEST." & vbCrLf & vbCrLf & stSignature
MailDoc.SAVEMESSAGEONSEND = True
Set AttachME = MailDoc.CREATERICHTEXTITEM("location")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "Attachment", "location")
MailDoc.PostedDate = Now()
'On Error GoTo errorhandler1
MailDoc.SEND 0, Recipient
Set Maildb = Nothing
Set MailDoc = Nothing
Set Session = Nothing
.ScreenUpdating = True
.DisplayAlerts = True
'errorhandler1:
'
'Set Maildb = Nothing
'Set MailDoc = Nothing
'Set Session = Nothing
'End If
'Next x
End With
End Sub
""