VBA about sending e-mail automatickly

  • Thread starter Thread starter how to send a e-mail with a annex automa
  • Start date Start date
H

how to send a e-mail with a annex automa

dear all ,

please help me to check the following VBA about sending e-mail automatickly,
i didnot know why can i not sent the TYPE of . pdf.

Sub SendMail(MailTo As String, MailTopic As String, MailContent As String,
MailAttachment As String)


On Error Resume Next



Dim objMail As MailItem

Set objOutlook = New Outlook.Application

Set objMail = objOutlook.CreateItem(olMailItem)

With objMail

..To = MailTo


..Subject = MailTopic


..Body = MailContent


..Attachments.Add MailAttachment


..Send

End With


Set objMail = Nothing



End Sub

Sub test()

SendMail "(e-mail address removed)", "This is auto send mail by excel",
"enclosing is code", "C:\Outlook.xls"

End Sub



thank you

yini
 
So what precisely happens when you try to use this code to send a PDF file?
Is this code running in the Outlook VBA environment or somewhere else? Have
you tried commenting out the On Error Resume Next statement?
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"how to send a e-mail with a annex automa"
 
Back
Top