Louts notes Attachments ,change attachment file name

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
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,214,548
Messages
6,120,146
Members
448,948
Latest member
spamiki

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top