ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Multiple Email Address in Notes (https://www.excelbanter.com/excel-programming/335778-multiple-email-address-notes.html)

Nigel

Multiple Email Address in Notes
 
I have code to send email from excel using notes but the sendto is causing
some problems, the address seperator we use is ",". But no matter what I do I
cannot get ti to send to more than one address (the first one in the
list).Here is the complete code for sending the email. Any help would be
appreciated

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



On Error Resume Next
emailsendto = m" '' Required -
Send to address

'EMailCCTo = "" '' Optional
'EMailBCCTo = "" '' Optional
EmailSubject = " GPR Variance Report"
''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)
'With objNotesField
' .appendtext "Daily Sales Report"
'End With
''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 e-mail is generated by an automated process."
.ADDNEWLINE 1
.appendtext "Please contact a member of the BI team should you have any
questions."
.ADDNEWLINE 2
End With

''Attach the file --1454 indicate a file attachment


''objNotesField = objNotesField.EMBEDOBJECT(1454, "", "C:\Temp\test.xls")
objNotesField = objNotesField.EMBEDOBJECT(1454, "", "c:\spreadsheets\" &
newworksheet)

''Send the e-mail
objNotesDocument.Send (0)

Nigel

Multiple Email Address in Notes
 
I solved the problwm, I converted the emailsendto to an array and it now
works fine

Nigel

"Nigel" wrote:

I have code to send email from excel using notes but the sendto is causing
some problems, the address seperator we use is ",". But no matter what I do I
cannot get ti to send to more than one address (the first one in the
list).Here is the complete code for sending the email. Any help would be
appreciated

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



On Error Resume Next
emailsendto = m" '' Required -
Send to address

'EMailCCTo = "" '' Optional
'EMailBCCTo = "" '' Optional
EmailSubject = " GPR Variance Report"
''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)
'With objNotesField
' .appendtext "Daily Sales Report"
'End With
''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 e-mail is generated by an automated process."
.ADDNEWLINE 1
.appendtext "Please contact a member of the BI team should you have any
questions."
.ADDNEWLINE 2
End With

''Attach the file --1454 indicate a file attachment


''objNotesField = objNotesField.EMBEDOBJECT(1454, "", "C:\Temp\test.xls")
objNotesField = objNotesField.EMBEDOBJECT(1454, "", "c:\spreadsheets\" &
newworksheet)

''Send the e-mail
objNotesDocument.Send (0)



All times are GMT +1. The time now is 12:29 AM.

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