Saturday, October 8, 2011

How to mail through VBA from Outlook

With help this macro code you can mail easily from outlook in just a single click....


Sub Mail ()
ESubject = "Mail Subject"
SendTo = "email-id"
CCTo = "email-id"
'Ebody = "TEST MAIL"
Ebody = "Mail Body"
newfilename = " The complete Path of file that to mail"
Set App = CreateObject("Outlook.Application")
Set Itm = App.CreateItem(0)
With Itm
.Subject = ESubject
.To = SendTo
.CC = CCTo
.Body = Ebody
.Attachments.Add newfilename
.send
End With
Set App = Nothing
Set Itm = Nothin
End Sub ()

No comments:

Post a Comment