Sending outlook mail from excel using VBA

  • Thread starter Thread starter Thirusivamani
  • Start date Start date
T

Thirusivamani

Run-time error '287'
The following programme throws an error "Application-defined or
Object-defined error" at "Mail.Send"

Can anyone help me to automate outlook from excel VBA.

Dim olApp As New Outlook.Application
Dim Mail As Outlook.MailItem

Set olApp = New Outlook.Application
Set Mail = olApp.CreateItem(olMailItem)

Mail.subject = "test"
Mail.To = "ATH020"
Mail.body = "Hi guys! this is a test mail"
Mail.display
Mail.Send
Set Mail = Nothing
Set olApp = Nothing
 
Probably that's subject to the Outlook security model. You can avoid that
e.g. by using the Redemption (www.dimastr.com). One alternative would be to
just display the message and let the user hit the Send button.

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool:
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Fri, 6 Jun 2008 04:25:01 -0700 schrieb Thirusivamani:
 
Back
Top