Hi Shay,

Here is the solution. just change the " smtp.xxxxxxxx.com" which is in the 
CDO_Mail_Small_Text procedure with the appropriate one.

let me know if you have any queries.

regards
Mugundan 
Office VBA Trainer

________________________________

Sub send_mail()

    Dim lngI As Long
    Dim strSubject As String
    Dim strBody As String
    Dim strFrom As String
    Dim idMaill As Variant

    On Error GoTo Err
    
    Application.ScreenUpdating = False
    
    Application.DisplayAlerts = False
    
    
    strSubject = "Test Mail"
    strBody = "Test Mail"
    strFrom = "shahinarafi...@gmail.com"


        For lngI = 1 To Sheets("Sheet1").Range("A1").CurrentRegion.Rows.Count
           
           Call CDO_Mail_Small_Text(strFrom, Cells(lngI, "A").Value, strBody, 
strSubject)
        
        Next

    MsgBox "All Mails Sent sucessfully", vbInformation, "Mailing"
    
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True

Err:
    If Err.Number <> 0 Then MsgBox Err.Number & vbCrLf & Err.Description, 
vbCritical, "Mailing"

End Sub

________________________________

Sub CDO_Mail_Small_Text(strFrom, strTo, strBody, strSubject, Optional strCC, 
Optional strBCC)
    
    Dim iMsg As Object
    Dim iConf As Object
    Dim Flds As Variant
    
    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")

        iConf.Load -1
        Set Flds = iConf.Fields
        With Flds
            .Item("http://schemas.microsoft.com/cdo/configuration/sendusing";) = 
2
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver";) 
= "smtp.xxxxxxxx.com"
            
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport";) = 25
            .Update
        End With

    With iMsg
    
       Set .Configuration = iConf
           .To = strTo
         ' .CC = strCC
         ' .BCC = strBCC
           .from = strFrom
           .Subject = strSubject
           .TextBody = strBody
           .Send
       End With

End Sub

________________________________

________________________________


________________________________
>
>From: shay shay <shahinarafi...@gmail.com>
To: excel-macros@googlegroups.com
Sent: Monday, January 5, 2009 7:07:37 PM
Subject: $$Excel-Macros$$ Re: Mail merge activity from excel to Outlook!!! 
URGENT!!!!!


Girish, 
 
         I am facing an error as User- defined type not defined for all Dims.
 
Regards,
Shay


 
On Mon, Jan 5, 2009 at 5:42 PM, girishkr...@gmail.com <girishkr...@gmail.com> 
wrote:


This module can help u out in sending email by outlook,
I have considered data is been in "sheet1" and email id in Col"A"
subject in "col C"
add body of the email as u want in space provided.
This will send all the emails through your current profile itself,
whichever would be activated in your outlook application.



Dim oXlWkBk As Excel.Workbook ' Excel Work Book Object

Sub send_mail()
Dim i As Long
Dim olApp As Outlook.Application
Dim olMail As MailItem

Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)

Application.ScreenUpdating = False
Application.DisplayAlerts = False
Sheets("Sheet1").Activate

For i = 2 To Range("A65535").End(xlUp).Row

   With olMail
   .To = Cells(i, "A").Value
   .Subject = Cells(i, "C").Value
   .body = "Add your body over here"
   .Send
End With
Next i
MsgBox "All Mails Sent succfully"

Application.ScreenUpdating = True
Application.DisplayAlerts = True

End Sub



On Jan 5, 10:13 am, "shay shay" <shahinarafi...@gmail.com> wrote:
> Hello All,
>
>              I have an excel sheet and it contains 800 client names in
> column A, I want to mail these 800 clients using outlook, is there any way
> where in I can create a macro which automatically mails these people as soon
> as I open the excel sheet. its similar to mail merge activity but I am new
> to it, can some one guide me, its urgent.
> --
> Shay
>
> A Thinker tends to use reason and logic
>
> A feeler tends to use values and subjective Judgement.
>
> Be a Thinker in Life.



-- 
Shay

A Thinker tends to use reason and logic

A feeler tends to use values and subjective Judgement.

Be a Thinker in Life.



      
--~--~---------~--~----~------------~-------~--~----~
Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/excel-macros?hl=en

Visit & Join Our Orkut Community at 
http://www.orkut.com/Community.aspx?cmm=22913620

To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com

To see the Daily Excel Tips, Go to:
http://exceldailytip.blogspot.com
 
If you find any spam message in the group, please send an email to Ayush @ 
jainayus...@gmail.com
-~----------~----~----~----~------~----~------~--~---

Reply via email to