santhoshlk
Board Regular
- Joined
- Feb 6, 2006
- Messages
- 206
hi dudes...
kinldy help me...
Iam using a macro to send mass mails to my clients attaching a file to each
my code is like this:
Sub Mail_Cust()
Dim OutApp As Object
Dim OutMail As Object
Dim EmailSubject As String
Dim EmailSendTo As String
Dim MailBody As String
Path = "Y:\Customers\Statements of Accounts\20111102\"
'Select Row Number of customer to email
'rownum = InputBox("enter a row number from 1 to x")
'Set Rng = Range(Range("D2:D50"), Range("D" & Rows.Count).End(xlUp))
Dim rng As Range: Set rng = Range(Range("D2:D50"), Range("D" & Rows.Count).End(xlUp))
Dim cell As Range
Dim rowNum As Long
Dim fileNme As String
For Each cell In rng
rowNum = cell.Row
If cell.Value <> "" Then
EmailSendTo = Cells(rowNum, 4).Value
fileNme = Path & Cells(rowNum, 1).Value & ".pdf"
' Message subject
EmailSubject = Cells(rowNum, 6).Value
'Subject string
Msg = "Dear customer," & vbNewLine & vbNewLine
Msg = Msg & "Please find attached the Statement of Accounts as at 31st October 2011" & vbNewLine
Msg = Msg & "Kindly arrange to pay against the due invoices immediately. " & vbNewLine & vbNewLine
Msg = Msg & "Thanks & Regards," & vbNewLine & vbNewLine
Msg = Msg & ""
Msg = Msg & "" & vbNewLine
Msg = Msg & "" & vbNewLine
MailBody = Msg
'Send Mail
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(o)
With OutMail
.Subject = EmailSubject
.To = EmailSendTo
.body = MailBody
.Attachments.Add fileNme
.Display
'.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End If
Next
End Sub
now my prob is when the macro goes for a new mail with attachments and mail body and all... it misses my outlook signature.
if i am creating a new mail signature appears. but when i run from macro my signature is missing... can any one help....
kinldy help me...
Iam using a macro to send mass mails to my clients attaching a file to each
my code is like this:
Sub Mail_Cust()
Dim OutApp As Object
Dim OutMail As Object
Dim EmailSubject As String
Dim EmailSendTo As String
Dim MailBody As String
Path = "Y:\Customers\Statements of Accounts\20111102\"
'Select Row Number of customer to email
'rownum = InputBox("enter a row number from 1 to x")
'Set Rng = Range(Range("D2:D50"), Range("D" & Rows.Count).End(xlUp))
Dim rng As Range: Set rng = Range(Range("D2:D50"), Range("D" & Rows.Count).End(xlUp))
Dim cell As Range
Dim rowNum As Long
Dim fileNme As String
For Each cell In rng
rowNum = cell.Row
If cell.Value <> "" Then
EmailSendTo = Cells(rowNum, 4).Value
fileNme = Path & Cells(rowNum, 1).Value & ".pdf"
' Message subject
EmailSubject = Cells(rowNum, 6).Value
'Subject string
Msg = "Dear customer," & vbNewLine & vbNewLine
Msg = Msg & "Please find attached the Statement of Accounts as at 31st October 2011" & vbNewLine
Msg = Msg & "Kindly arrange to pay against the due invoices immediately. " & vbNewLine & vbNewLine
Msg = Msg & "Thanks & Regards," & vbNewLine & vbNewLine
Msg = Msg & ""
Msg = Msg & "" & vbNewLine
Msg = Msg & "" & vbNewLine
MailBody = Msg
'Send Mail
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(o)
With OutMail
.Subject = EmailSubject
.To = EmailSendTo
.body = MailBody
.Attachments.Add fileNme
.Display
'.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End If
Next
End Sub
now my prob is when the macro goes for a new mail with attachments and mail body and all... it misses my outlook signature.
if i am creating a new mail signature appears. but when i run from macro my signature is missing... can any one help....