×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Microsoft: Office FAQ

Outlook FAQs

How to send Outlook email from other MS Office Apps. by SQLBI
Posted: 7 Oct 03 (Edited 23 Jan 04)

There are a regular number of posts asking how to send emails from various other applications. The following code will create an instance of MS Outlook from any MS Office Application and send an email based on a number of variables.

Public Sub SendEmail()

Dim olApp As Object
Dim subject As String
Dim olMailItem
Dim newMail
Dim newRecipient
Dim mailBody As String
Dim strAddress As String

subject = "Your text here"
***This can be hard typed or a variable passed from another part of your program.
mailBody = "Your text here"***This can be hard typed or a variable passed from another part of your program.
strAddress = "Email Address Here"***This can be hard typed or a variable passed from another part of your program.


Set olApp = CreateObject("Outlook.Application")
Set newMail = olApp.CreateItem(olMailItem)
Set newRecipient = newMail.Recipients.Add(strAddress)

With newMail
.subject = subject
.body = mailBody
End With

newMail.send
    
olApp.Quit
Set olApp = Nothing
Set newMail = Nothing
Set newRecipient = Nothing

End Sub


Hope this helps.

Back to Microsoft: Office FAQ Index
Back to Microsoft: Office Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close