CHRIS RAE'S VBA PAGES
|Description:|| Send a mail item using Outlook. Will work from all incarnations of VBA.|
' Chris Rae's VBA Code Archive - http://chrisrae.com/vba
' Code written 19/5/00 by Chris Rae.
Dim myOutlook As Object
Dim myMailItem As Object
' Make instance
Set myOutlook = CreateObject("Outlook.Application")
' Make mail item
Set myMailItem = myOutlook.createitem(0)
' Set recipient (internal mail)
myMailItem.Recipients.Add "Gates, Bill"
' Set recipient (external mail)
' Set subject
myMailItem.Subject = "test"
' Set body
myMailItem.body = "Quick test!"
' And send it!
' Close instance
Set myOutlook = Nothing
You're free to use these routines for anything you want - all I ask is that for commercial use you give me credit somewhere. You may instead want to head back to the index for my Visual Basic for Applications Pages or the main routines archive page.