Lotus Notes automated e-mail

tasander

Board Regular
Joined
Mar 6, 2009
Messages
67
I have sourced much code of the internet to be able to send e-mails via lotus notes from excel, although the code is likely to be very crude it seems to work fine apart from 2 small issues that i hope someone might be able to offer me guidance on.

The issues are:
1: In the sent items folder, no name appears in the recipient column even though everyone has received the e-mail and i can see their names if i open the e-mail.

2. If a user has an image signature rather than the standard text then my code just identifies where the image is saved rather than displaying the image.

Many Thanks in advance

--------------------------------------------------------------------------------------------------------------------
Dim Rec As String, vaRecipient() As String, ccRecipient() As String
Public stMsg As String
Public stTitle As String
Public stAttachment As String
Public stSubject As String
Public noSession
Public noDatabase
Public noDocument
Public Signature As String
Public obAttachment As Object, EmbedObject As Object
Public NoAttachment As Object
Const EMBED_ATTACHMENT As Long = 1454

Sub SendEmail()

On Error GoTo ErrorMessage1


' add reipients, CC, Subject and Message

Call Add_Recipients
Call Add_CC
Call Add_Subject
Call Add_Message

'add extra comments in
SenderName = InputBox("Insert your name, which will be added to the end of your e-mail." & vbNewLine & vbNewLine & "Press cancel to stop the e-mail", "Name")

If StrPtr(SenderName) = 0 Then
End
End If
'Instantiate the Lotus Notes COM's Objects.
Set noSession = CreateObject("Notes.NotesSession")
Set noDatabase = noSession.GETDATABASE("", "")

'If Lotus Notes is not open then open the mail-part of it.
If noDatabase.IsOpen = False Then noDatabase.OPENMAIL

'Create the e-mail and the attachment.
Set noDocument = noDatabase.CreateDocument

On Error Resume Next

'Attach Your Signature
Signature = noDatabase.GetProfileDocument("CalendarProfile").GetItemValue("Signature")(0)

On Error GoTo ErrorMessage1
'Add values to the created e-mail main properties.
With noDocument
.Form = "Memo"
.SendTo = vaRecipient
.copyto = ccRecipient
.Subject = stSubject
.Body = "Please see attached" & vbNewLine & vbNewLine & "Regards" & vbNewLine & vbNewLine & SenderName & vbNewLine & vbNewLine & Signature
.SAVEMESSAGEONSEND = True
End With

'Send the e-mail.
With noDocument
.PostedDate = Now()
.Send 0, vaRecipient
End With

On Error GoTo ErrorMessage2

'Release objects from the memory.
Set EmbedObject = Nothing
Set obAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing

End sub
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,223,264
Messages
6,171,081
Members
452,377
Latest member
bradfordsam

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