Hi,
I got this Macro from Chris...
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub SendAllEmails()
Dim i As Long, j As Long, strbody As String, strHeader As String, strFooter As String
strHeader = "Hi," & Chr(10) & "Here are your details:" & Chr(10)
strFooter = "Please check." & Chr(10) & "Regards," & Chr(10) & "Sha"
For i = 2 To [A65536].End(xlUp).Row
strbody = ""
For j = 2 To 11
strbody = strbody & Cells(1, j).Value & ": " & Cells(i, j).Value & Chr(10)
Next
NewCDOMessage "details", strHeader & strbody & strFooter, Cells(i, 1).Value, "", "", False
Sleep (100) '1000 = 1s
Next
End Sub
Public Sub NewCDOMessage(strSubject As String, strbody As String, Optional strTo As String, _
Optional strCC As String, Optional strBCC As String, Optional SendYN As Boolean, _
Optional AttachYN As Boolean = False, Optional Attach1 As String)
Dim iMsg As Object
Dim iConf As Object
Dim Flds As Variant
Set iMsg = CreateObject("CDO.Message"
)
Set iConf = CreateObject("CDO.Configur
ation")
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("
http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("
http://schemas.microsoft.com/cdo/configuration/smtpserver")
_
= "Exchangename"
.Item("
http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Item("
http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("
http://schemas.microsoft.com/cdo/configuration/sendusername") = "sharath"
.Item("
http://schemas.microsoft.com/cdo/configuration/sendpassword") = ""
.Update
End With
With iMsg
Set .Configuration = iConf
.To = strTo
If strCC <> "" Then .CC = strCC
If strBCC <> "" Then .BCC = strBCC
.From = "sha@plc.com"
.Subject = strSubject
.TextBody = strbody
If AttachYN And Attach1 <> "" Then .AddAttachment Attach1
.Send
End With
End Sub
Now i have an problem.How can i extend the colums.I have 20 colums of data and when mail send i guess only 6 colum data is sent.
Regards
Sharath