View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default VIA Excel - Composing a Lotus Notes email without sending

Hi PCLIVE

For info about Notes see this site
http://www.excelkb.com/?cNode=1X5M7A

Maybe you find your answer there

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"PCLIVE" wrote in message ...
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
--