ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VIA Excel - Composing a Lotus Notes email without sending (https://www.excelbanter.com/excel-programming/409335-via-excel-composing-lotus-notes-email-without-sending.html)

PCLIVE

VIA Excel - Composing a Lotus Notes email without sending
 
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
--




Ron de Bruin

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




PCLIVE

VIA Excel - Composing a Lotus Notes email without sending
 
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

--

"Ron de Bruin" wrote in message
...
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
--





All times are GMT +1. The time now is 07:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com