A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Sending outlook mail from excel using VBA



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 6th 08, 01:25 PM posted to microsoft.public.outlook.program_vba
Thirusivamani
external usenet poster
 
Posts: 1
Default Sending outlook mail from excel using VBA

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

Ads
  #2  
Old June 6th 08, 03:12 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Sending outlook mail from excel using VBA



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:

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

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
sending mails from excel...but mail body disappearing Jithu Outlook and VBA 0 January 10th 08 01:57 PM
Sending Emails from Excel Pete Outlook and VBA 1 March 25th 07 03:47 PM
Sending emails in Excel by Outlook tony wong Outlook and VBA 1 December 23rd 06 04:17 PM
Sending Mail from Excel with VBA RFraley Outlook and VBA 4 November 9th 06 05:33 PM
Problem sending mail via excel Jas Outlook and VBA 2 April 8th 06 09:44 PM


All times are GMT +1. The time now is 09:11 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.