Brook,
Here is some simple code that will create an email message. I use it in the
click event of a command button. Depending on the version of Outlook you are
using you will probably encounter the object model guard issues which are
certainly quite complex and beyond the scope of this post. Keep in mind that
this is the tip of the iceberg and you need to do some homework to use this
effectively.
Before using this code be sure to add a reference to the Outlook Object
Library (VBA - Tools, Referencs - Check Microsoft Outlook ??? Object Library)
Private Sub cmdEmail_Click()
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the "To" recipient to the message.
Set objOutlookRecip = .Recipients.Add(Me.Email)
objOutlookRecip.Type = olTo
' Set the Subject, Body, and Importance of the message.
.Subject = "My Subject"
.Body = "The main body of the email"
.Importance = olImportanceHigh 'olImportanceLow, olImportanceNormal
'Make the message visible
.Display
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub
Good Luck!!