Hi Mahesh,
I think below line highlighted in Red is creating problem. Simply remove this line. Sub send(i As Integer) Set myOlApp = CreateObject("Outlook.Application") Set mail = myOlApp.CreateItem(olMailItem) Set attach = mail.Attachments Worksheets(1).Select mail.To = Cells(i, 1) mail.CC = Cells(i, 2) mail.BCC = Cells(i, 3) mail.Subject = Cells(i, 4) mail.Body = Cells(i, 5) If Cells(i, 6) <> "" Then attach.Add "" & Cells(i, 6) & "" End If mail.send End Sub ____________________________________________________________________________ _____________________________________________________________ Sub email() Dim count As Integer Dim i As Integer Dim ok As Boolean Dim errcount As Integer Dim message As String Worksheets(1).Select count = Cells(11, 8) =>> Worksheets(2).Select ok = True errcount = 0 For i = 2 To count + 1 If Cells(i, 1) = "" And Cells(i, 2) = "" And Cells(i, 3) = "" Then ok = False errcount = errcount + 1 End If Next i If ok = True Then For i = 2 To count + 1 send (i) Next i Else message = MsgBox("You should have atleast one address in TO,CC or BCC field (" & errcount & " errors detected.)", vbOKOnly) = vbOK End If End Sub ____________________________________________________________________________ __________________________________________________________________ Regards, Upendra Singh 9910227325 From: excel-macros@googlegroups.com [mailto:excel-mac...@googlegroups.com] On Behalf Of mahesh parab Sent: Thursday, April 23, 2009 10:02 PM To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ Macro to send email through Excel Dear All i herewith attach the sample file on which i want to work,i took script from Mudassar Ramzans File which he posted to this group, i have already go through the code, but i have all my data on sheet1, when i run the macro it dont get connect to MS Outlook or cursur moves to sheet2,please help to resolve this. Thanks in advance --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---