VIA Excel - Composing a Lotus Notes email without sending

P

PCLIVE

I've got some code that sends an email through Lotus Notes. Through the
code, Excel specifies the recipient(s), the subject text, and the body text.
The email is then sent. What I'd like to be able to do is:
Just create / compose the email without sending it. I still want to
populate those areas mentioned, but I'd like to leave the new message open
for some modifications before sending. Does anyone know if this is
possible.

Thanks in advance.
Paul


Here is the code that I'm currently using.

Function SendEMailOnly()

Dim objNotesSession As Object
Dim objNotesMailFile As Object
Dim objNotesDocument As Object
Dim objNotesField As Object


On Error GoTo SendMailError

EMailSendTo = "Me"
EMailCCTo = "" '' Optional
EMailBCCTo = "" '' Optional
EmailSubject = ""

''Establish Connection to Notes
Set objNotesSession = CreateObject("Notes.NotesSession")

''Establish Connection to Mail File
'' .GETDATABASE("SERVER", "FILE")
Set objNotesMailFile = objNotesSession.GETDATABASE("", "")
''Open Mail
objNotesMailFile.OPENMAIL

''Create New Memo
Set objNotesDocument = objNotesMailFile.CREATEDOCUMENT

''Create 'Subject Field'
Set objNotesField = objNotesDocument.APPENDITEMVALUE("Subject",
EmailSubject)

''Create 'Send To' Field
Set objNotesField = objNotesDocument.APPENDITEMVALUE("SendTo", EMailSendTo)

''Create 'Copy To' Field
Set objNotesField = objNotesDocument.APPENDITEMVALUE("CopyTo", EMailCCTo)

''Create 'Blind Copy To' Field
Set objNotesField = objNotesDocument.APPENDITEMVALUE("BlindCopyTo",
EMailBCCTo)

''Create 'Body' of memo
Set objNotesField = objNotesDocument.CREATERICHTEXTITEM("Body")



With objNotesField

.APPENDTEXT "This is the first line."
.addnewline 1
.APPENDTEXT "Who's there?"
.addnewline 1
.APPENDTEXT "Hello"
.addnewline 2
.APPENDTEXT "Wazzup!"
.addnewline 1
.APPENDTEXT " Woo hoo!"
.addnewline 3
.APPENDTEXT "Cool"
.addnewline 1
.APPENDTEXT "Not Cool"
.addnewline 1
.APPENDTEXT " Oh No!"
.addnewline 2
.APPENDTEXT "This is the next to the last straw!"
.addnewline 1
.APPENDTEXT " Oh Yes!"
End With

objNotesField.addnewline 1

objNotesDocument.SaveMessageOnSend = True ' save in Sent folder
objNotesDocument.Send (0)

''Release storage
Set objNotesSession = Nothing
Set bjNotesSession = Nothing
Set objNotesMailFile = Nothing
Set objNotesDocument = Nothing
Set objNotesField = Nothing

''Set return code
SendMail = True


MsgBox "Your Lotus Notes message was successfully sent ..." & _
Chr$(13) & _
Chr$(13) & _
"A copy can be found in your Sent folder", vbInformation, "Email Send
Status"

Exit Function


SendMailError:
Msg = "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Err.Description
MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext

SendMail = False

End Function
--
 
P

PCLIVE

Thanks Ron.

I went to your site first. And had just come from the site you just
provided prior to posting. I found that site in a Google search. There's
some interesting stuff there, but I didn't see what I'm looking for. I will
look through it some more.

Thanks again,
Paul

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top