srinivasan2081
New Member
- Joined
- Sep 26, 2014
- Messages
- 1
Hi Gurus
Afternoon
I have a requirement at the moment , am sending the users to fill up a form and when they click on submit , the forms automatically pops up in my lotus note inbox
currently am using the below code for excel attachments to send to e mail, but i facing a difficulty now as if a user submits the same form again i am not able to differentiate the attachment
Please help to include the date or time or change subject to identify the files sent
"
Sub TestingLotusNotesEmail()
Dim noSession As Object, noDatabase As Object, noDocument As Object
Dim obAttachment As Object, EmbedObject As Object
Dim stSubject As Variant, stAttachment As String
Dim vaRecipient As Variant, vaMsg As Variant
Dim rng As Range
Set rng = Cells(Rows.Count, 1).End(xlUp)
rng.Offset(1) = rng + 1
Const EMBED_ATTACHMENT As Long = 1454
'Retrieve the path and filename of the active workbook.
stAttachment = ActiveWorkbook.FullName
'Initiate the Lotus Notes COM's Objects.
Set noSession = CreateObject("Notes.NotesSession")
Set noDatabase = noSession.GETDATABASE("", "")
'If Lotus Notes is not open then open the mail-part of it.
If noDatabase.IsOpen = False Then noDatabase.OPENMAIL
'Create the e-mail and the attachment.
Set noDocument = noDatabase.CreateDocument
Set obAttachment = noDocument.CreateRichTextItem("stAttachment")
Set EmbedObject = obAttachment.EmbedObject(EMBED_ATTACHMENT, "", stAttachment)
'Add values to the created e-mail main properties.
With noDocument
.Form = "Memo"
.SendTo = "___@email.com"
.Subject = "Material Purchase Requisition MPR 1001"
.Body = "Hi Materials Requirement Sheet !"
.SaveMessageOnSend = True
End With
'Send the e-mail.
With noDocument
.PostedDate = Now()
.Send 0, vaRecipient
End With
'Release objects from the memory.
Set EmbedObject = Nothing
Set obAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing
'Activate Excel for the user.
AppActivate "Microsoft Excel"
MsgBox "The e-mail has successfully been created and distributed.", vbInformation
End Sub
Regards
Afternoon
I have a requirement at the moment , am sending the users to fill up a form and when they click on submit , the forms automatically pops up in my lotus note inbox
currently am using the below code for excel attachments to send to e mail, but i facing a difficulty now as if a user submits the same form again i am not able to differentiate the attachment
Please help to include the date or time or change subject to identify the files sent
"
Sub TestingLotusNotesEmail()
Dim noSession As Object, noDatabase As Object, noDocument As Object
Dim obAttachment As Object, EmbedObject As Object
Dim stSubject As Variant, stAttachment As String
Dim vaRecipient As Variant, vaMsg As Variant
Dim rng As Range
Set rng = Cells(Rows.Count, 1).End(xlUp)
rng.Offset(1) = rng + 1
Const EMBED_ATTACHMENT As Long = 1454
'Retrieve the path and filename of the active workbook.
stAttachment = ActiveWorkbook.FullName
'Initiate the Lotus Notes COM's Objects.
Set noSession = CreateObject("Notes.NotesSession")
Set noDatabase = noSession.GETDATABASE("", "")
'If Lotus Notes is not open then open the mail-part of it.
If noDatabase.IsOpen = False Then noDatabase.OPENMAIL
'Create the e-mail and the attachment.
Set noDocument = noDatabase.CreateDocument
Set obAttachment = noDocument.CreateRichTextItem("stAttachment")
Set EmbedObject = obAttachment.EmbedObject(EMBED_ATTACHMENT, "", stAttachment)
'Add values to the created e-mail main properties.
With noDocument
.Form = "Memo"
.SendTo = "___@email.com"
.Subject = "Material Purchase Requisition MPR 1001"
.Body = "Hi Materials Requirement Sheet !"
.SaveMessageOnSend = True
End With
'Send the e-mail.
With noDocument
.PostedDate = Now()
.Send 0, vaRecipient
End With
'Release objects from the memory.
Set EmbedObject = Nothing
Set obAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing
'Activate Excel for the user.
AppActivate "Microsoft Excel"
MsgBox "The e-mail has successfully been created and distributed.", vbInformation
End Sub
Regards