Thanks Ashish I will check it out. :-) On Fri, Aug 12, 2011 at 4:31 AM, ashish koul <koul.ash...@gmail.com> wrote:
> try these > > > On Wed, Aug 10, 2011 at 6:10 PM, Chandra Shekar < > chandrashekarb....@gmail.com> wrote: > >> Hi, >> >> In below code some times I could able to send attachments but some times >> its not taking attachment at all. Please let me know whats is the problem in >> the below code. >> >> Sub sendmail() >> ' >> Dim UserName As String >> Dim MailDbName As String >> Dim Recipient As Variant >> Dim ccRecipient As String >> Dim Attachment1 As String >> Dim Maildb As Object >> Dim MailDoc As Object >> Dim AttachME As Object >> Dim AttachME2 As Object >> Dim AttachME3 As Object >> Dim AttachME4 As Object >> Dim AttachME5 As Object >> Dim Session As Object >> Dim EmbedObj1 As Object >> Dim EmbedObj2 As Object >> Dim EmbedObj3 As Object >> Dim EmbedObj4 As Object >> Dim EmbedObj5 As Object >> Dim stSignature As String >> With Application >> .ScreenUpdating = False >> .DisplayAlerts = False >> ' Open and locate current LOTUS NOTES User >> 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 >> Else >> Maildb.OPENMAIL >> End If >> ' Create New Mail and Address Title Handlers >> Set MailDoc = Maildb.CREATEDOCUMENT >> MailDoc.Form = "Memo" >> stSignature = >> Maildb.GetProfileDocument("CalendarProfile").GetItemValue("Signature")(0) >> ' Select range of e-mail addresses >> Recipient = notes_id >> MailDoc.SendTo = Recipient >> MailDoc.Subject = "Test Mail " >> MailDoc.Body = "Hi," & vbCrLf & vbCrLf & "Please find attached schedule >> for the day " & vbCrLf & vbCrLf & "Regards" & vbCrLf & vbCrLf & "Chandru" >> ' Select Workbook to Attach to E-Mail >> MailDoc.SaveMessageOnSend = True >> Attachment1 = "C:\temp.bmp" ' Required File Name" >> If Attachment1 <> "" Then >> On Error Resume Next >> Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment1") >> Set EmbedObj1 = AttachME.EmbedObject(1454, "", Attachment1, "Attachment1") >> MailDoc.CREATERICHTEXTITEM ("Attachment1") >> On Error Resume Next >> End If >> MailDoc.PostedDate = Now() >> On Error GoTo errorhandler1 >> MailDoc.SEND 0, Recipient >> Set Maildb = Nothing >> Set MailDoc = Nothing >> Set AttachME = Nothing >> Set AttachME2 = Nothing >> Set AttachME3 = Nothing >> Set AttachME4 = Nothing >> Set AttachME5 = Nothing >> Set Session = Nothing >> Set EmbedObj1 = Nothing >> Set EmbedObj2 = Nothing >> Set EmbedObj3 = Nothing >> Set EmbedObj4 = Nothing >> Set EmbedObj5 = Nothing >> .ScreenUpdating = True >> .DisplayAlerts = True >> Exit Sub >> End With >> errorhandler1: >> MsgBox Err.Description >> Set Maildb = Nothing >> Set MailDoc = Nothing >> Set AttachME = Nothing >> Set AttachME2 = Nothing >> Set AttachME3 = Nothing >> Set AttachME4 = Nothing >> Set AttachME5 = Nothing >> Set Session = Nothing >> Set EmbedObj1 = Nothing >> Set EmbedObj2 = Nothing >> Set EmbedObj3 = Nothing >> Set EmbedObj4 = Nothing >> Set EmbedObj5 = Nothing >> End Sub >> >> -- >> >> ---------------------------------------------------------------------------------- >> 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 >> > > > > -- > *Regards* > * * > *Ashish Koul* > *akoul*.*blogspot*.com <http://akoul.blogspot.com/> > http://akoul.posterous.com/ > *akoul*.wordpress.com <http://akoul.wordpress.com/> > My Linkedin Profile <http://in.linkedin.com/pub/ashish-koul/10/400/830> > > > P Before printing, think about the environment. > > > -- > > ---------------------------------------------------------------------------------- > 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 > -- ---------------------------------------------------------------------------------- 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