VBA about sending e-mail automatickly

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

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


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


Sue Mosher [MVP]

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question