VB Code Help for Mail Body

santhoshlk

Board Regular
Joined
Feb 6, 2006
Messages
206
hi Experts...

Iam using the following code to trigger mails to my clients in excel via outlook.

But when my new mails opened i cant see my Outlook signature and i Need to add the following text to be added in each mail automatically.. kindly help.

_____________

Sub Mail_Cust()
Dim OutApp As Object
Dim OutMail As Object
Dim EmailSubject As String
Dim EmailSendTo As String
Dim MailBody As String

'Path of stored statements
Path = "C:\junk\"

'Select Row Number of customer to email
rownum = InputBox("enter customer row number")

FileNme = Path & Cells(rownum, 1).Value & ".pdf"
EmailSendTo = Cells(rownum, 4).Value

' Message subject
EmailSubject = "Test"

'Subject string
MailBody = "enter body text"

'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 Sub
_________

pls help me to add the following text in the mail body

"Dear customer,

Please find attached the Statement of Accounts as at (todays date).
Kindly arrange to pay against the due invoices immediately.

Thanks & regards,"

(My outlook signature)
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Have a look here for adding a signature to your Email.
Code:
www.rondebruin.nl/mail/folder3/signature.htm

Also, a couple of changes
Code:
Sub Mail_Cust()
Dim OutApp As Object
Dim OutMail As Object
Dim EmailSubject As String
Dim EmailSendTo As String
Dim MailBody As String

'Path of stored statements
Path = "C:\junk\"

'Select Row Number of customer to email
rownum = InputBox("enter customer row number")

FileNme = Path & Cells(rownum, 1).Value & ".pdf"
EmailSendTo = Cells(rownum, 4).Value


'Send Mail
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(o)
With OutMail
.Subject = "Test"
.To = EmailSendTo
.body ="Dear customer," & vbLf & _
"Please find attached the Statement of Accounts as at (todays date)." & vbLf & _
"Kindly arrange to pay against the due invoices immediately." & vbLf & _
"Thanks & regards,"
.Attachments.Add FileNme
.Display
'.Send
End With

Set OutMail = Nothing
Set OutApp = Nothing

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,656
Messages
6,120,762
Members
448,991
Latest member
Hanakoro

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top