I am writing the code for excel to attatch the current excel file into the email by Lotusscript. May I know which function I can use?
My current code:
Sub Sendmail_to_users()
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, ccRecipient As Variant
Dim vaMsg As Range
Dim ws, uidoc, uidb As Object
Dim Data As Object
'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
Sheets("mail_format").Range("A1:H14").Copy _
Destination:=Sheets("Mail_Content").Range("A2:H13")
Worksheets("Mail_Content").Activate
Worksheets("Mail_Content").Range("A2:H13").Select
Worksheets("Mail_Content").Range("A2:H13").Copy
Set Data = New DataObject
Data.GetFromClipboard
Set noDocument = noDatabase.CreateDocument
Set ws = CreateObject("Notes.NotesUIWorkspace")
Set uidoc = ws.CURRENTDOCUMENT
Set uidoc = ws.editdocument(True, noDocument)
Call uidoc.FIELDSETTEXT("Body", " ")
Call uidoc.gotoField("Body")
Call uidoc.Paste
Call uidoc.Save
Call uidoc.Close
Set noDocument = uidoc.DOCUMENT
'Add values to the created e-mail main properties.
With noDocument
.Form = "Memo"
.computewithform False, False
.savemessageonsend = True
.Save True, False, True
vaRecipient = Worksheets("Recipient").Range("A2:A150")
ccRecipient = Worksheets("Recipient").Range("C2:C150")
.SendTo = vaRecipient
.CopyTo = ccRecipient
.Subject = "xxx"
.Send 0, vaRecipient
PostedDate = Now()
End With