Hi Give below is the code I used to send email and attache attachement to the same email. Only success I had till now is in sending email and attaching same sheet as attachement. I am not able to attache a pdf and send it through email.
Can some one please advsie me how can I attache a pdf file and send it as attachment to the email. -------------------------------------------------------------------------------------------------------------------------------------------------------------------- Public Function sendLotusMail(recipientTO As String, recipientCC As String, recipientBCC As String, emailSUBJECT As String, emailBODY As String, emailATTACHMENT As String) ' setting up various objects Dim Maildb As Object Dim UserName As String Dim MailDbName As String Dim MailDoc As Object Dim attachME As Object Dim Session As Object Dim EmbedObj1 As Object Dim obAttachment As Object ' creating a notes session Set Session = CreateObject("Notes.NotesSession") UserName = Session.UserName MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf" Set Maildb = Session.GETDATABASE("", MailDbName) If Maildb.IsOpen <> True Then On Error Resume Next Maildb.OPENMAIL End If Set MailDoc = Maildb.CreateDocument MailDoc.Form = "Memo" ' loading the lotus notes e-mail with the inputed data With MailDoc .SendTo = recipientTO .copyto = recipientCC .blindcopyto = recipientBCC .Subject = emailSUBJECT .Body = emailBODY .attachment.Add "emailATTACHMENT" End With ' saving message MailDoc.SaveMessageOnSend = True 'Set up the embedded object and attachment and attach it ActiveWorkbook.Save If emailATTACHMENT <> "" Then Set attachME = MailDoc.CREATERICHTEXTITEM("emailATTACHMENT") Set EmbedObj1 = attachME.EMBEDOBJECT(1454, "emailATTACHEMNTt", ActiveWorkbook.FullName) 'Set EmbedObj1 = attachME.EMBEDOBJECT(1454, "emailATTACHEMNT", ActiveWorkbook.ActiveSheet.FullName, "") 'Set EmbedObj1 = attachME.EMBEDOBJECT(1454, "", "I:\Users \Harsimran\Project\Notes\test.xls", "Attachment") 'MailDoc.CREATERICHTEXTITEM ("emailATTACHEMT") On Error Resume Next End If ' send e-mail !!!! MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items ' if error in attachment or name of recipients On Error GoTo errorHandler1 MailDoc.Send 0, recipient Set Maildb = Nothing Set MailDoc = Nothing Set attachME = Nothing Set Session = Nothing Set EmbedObj1 = Nothing 'Unload Me Exit Function ' setting up the error message errorHandler1: MsgBox "Incorrect name supplied or the attachment has not attached," & _ "or your Lotus Notes has not opened correctly. Recommend you open up Lotus Notes" & _ "to ensure the application runs correctly and that a vaild connection exists" Set Maildb = Nothing Set MailDoc = Nothing Set attachME = Nothing Set Session = Nothing Set EmbedObj1 = Nothing End Function -------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel