Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / July 2003

Tip: Looking for answers? Try searching our database.

Automated Email Messages from Excel w/VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Aaron - 30 Jul 2003 04:00 GMT
Hi - the routine below sends an email message on behalf of
outlook from MS Excel.  Every time it tries to send an
email a message in outlook pops up saying that another
application is trying to send an email on outlook's
behalf, would i like to allow this?

Does anyone know if there is a way to avoid having outlook
display this message and just send the email?  My routine
is displayed below my signature.  Thanks!
-Aaron

Sub SendEmails()

'\\DECLARATIONS\\
Dim mlNewMessage As MailItem        
Dim myOlApp                        
Dim strBody As String

'\\-BUILD EMAIL BODY-\\
strBody = "This is the Email Body"

'\\E-MAIL GENERATION BUILD BEGINS HERE\\
Do Until Range("A1").Offset(a, 0) = "STOP"

   Set myOlApp = CreateObject
("Outlook.Application")           'Create New Outlook Item
   Set mlNewMessage = myOlApp.CreateItem
(olMailItem)           'Create New Mail Item
   mlNewMessage.Body = strDear & strBody &
strConfidentiality  'Defines Email Body
   mlNewMessage.Subject = "Message
Subject"          'Defines "Subject"
   mlNewMessage.To = Range("A1").Offset(a,
1)                  'Defines "To"
   
mlNewMessage.Send                                          
'Sends Email Message
     
   Set myOlApp =
Nothing                                       'Clears
mlOlApp Variable
   Set mlNewMessage =
Nothing                                  'Clears mlOlApp
Variable
a = a + 1
Loop

End Sub
Ken Slovak - [MVP - Outlook] - 30 Jul 2003 15:21 GMT
See http://64.78.15.8/outlook/esecup.htm#autosec

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm

> Hi - the routine below sends an email message on behalf of
> outlook from MS Excel.  Every time it tries to send an
[quoted text clipped - 44 lines]
>
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.