Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 123
Default Send email from excel to notes - save email in sent folder

Hi,

I am sending email from excel to notes using below code.

Dim LotusNotesSession As Object
Dim LotusNotesMailFile As Object
Dim LotusNotesDocument As Object
Dim LotusNotesField As Object

strshdrivepath = Range("c33").Value
If Right(strshdrivepath, 1) < "\" Then
strshdrivepath = strshdrivepath & "\"
End If

Dim vaRecipient As Variant
vaRecipient = Sheets("RawData").Range("c6:c30").Value

strDate = Format(Now(), "mm/dd/yy")
strmsg = "Daily Accum file as of " & strDate & " (Restricted)"

vaFiles = strshdrivepath & Myfile & ".zip"

Set LotusNotesSession = CreateObject("Notes.NotesSession")
Set LotusNotesMailFile = LotusNotesSession.GETDATABASE("", "")
LotusNotesMailFile.OPENMAIL
Set LotusNotesDocument = LotusNotesMailFile.CREATEDOCUMENT
Set LotusNotesField = LotusNotesDocument.APPENDITEMVALUE("Subject",
strmsg)
Set LotusNotesField = LotusNotesDocument.APPENDITEMVALUE("SendTo",
vaRecipient)
Set LotusNotesField = LotusNotesDocument.CREATERICHTEXTITEM("Body")

With LotusNotesField
.addnewline 1
.appendtext "Restricted"
.addnewline 2
.appendtext "Hi All,"
.addnewline 2
.appendtext "Please find the attached file, in an Excel and
Notebook format for your review."
.addnewline 2
.appendtext "Thanks & Regards"
.addnewline 1
.appendtext Sheets("RawData").Range("c36").Value
.addnewline 1
.appendtext Sheets("RawData").Range("c37").Value
.addnewline 1
.appendtext Sheets("RawData").Range("c38").Value
.addnewline 2
.appendtext "********************* System Generated email
********************* "
.addnewline 2

End With

LotusNotesField = LotusNotesField.EmbedObject(1454, "", vaFiles)

LotusNotesDocument.savemessageonsend = True
LotusNotesDocument.Posteddate = Now()
LotusNotesDocument.Send (0)

Set LotusNotesSession = Nothing
Set bjNotesSession = Nothing
Set LotusNotesMailFile = Nothing
Set LotusNotesDocument = Nothing
Set LotusNotesField = Nothing
SendMail = True

MsgBox "The e-mail has successfully been created and sent!", vbInformation


The multiple recipients are picked from Range("c6:c30").Value.

The email is not getting saved in the sent item folder. please help me on
that.

I have tried below code to solve this

' Dim recip(25) As Variant
' recip(0) = Sheets("RawData").Range("c6").Value
' recip(1) = Sheets("RawData").Range("c7").Value
' recip(2) = Sheets("RawData").Range("c8").Value

But my number of recepients can change.

please help!!
thx!

Boss
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
assign a macro to send email in lotus notes from Excel spreadsheet pdaws Excel Worksheet Functions 0 May 6th 10 05:13 PM
Send email in Lotus Notes CLR Excel Programming 2 May 29th 08 11:09 AM
How do I send an Excel workbook through Lotus Notes Email? Valerie Excel Discussion (Misc queries) 1 May 3rd 08 04:51 PM
Excel VBA to send email using Lotus Notes Nirmal Singh Excel Programming 3 April 28th 05 11:15 PM
Send email with Lotus Notes Simon Excel Programming 1 May 6th 04 04:56 AM


All times are GMT +1. The time now is 06:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"