' Declare VARS
Dim objOutlookApp As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objMail As Outlook.MailItem
Dim FSys As New FileSystemObject
Dim TStream
Dim strBody as Sting
' Set the application objects
Set objOutlookApp = Outlook.Application
Set objNameSpace = objOutlookApp.GetNamespace("MAPI")
' Get Message Body
Set TStream = FSys.OpenTextFile("MyFile.txt", ForReading)
txtLocal.Text = TStream.ReadAll
' Login to Outlook
objNameSpace.Logon
' Set the mail item
Set objMail = objOutlookApp.CreateItem(olMailItem)
' Set properties for the mail item and send mail
With objMail
.To = "steveb@njatc.org"
.Subject = "Message Sent from Visual Basic"
.Body = "This message was created by automating Outlook from VB!"
.Send
End With
' Logoff NameSpace
objNameSpace.Logoff
'Release objects
Set objMail = Nothing
Set objNameSpace = Nothing
Set objOutlookApp = Nothing
End Sub__________________________________
Stephen W. Boyd
NJATC I.T. Support
steveb@njatc.org
"Our perceptions are our personal realities" ...unknown