Activate MS Outlook in macro?
Dim oOutlook As Object
Dim oMailItem As Object
Dim oRecipient As Object
Dim oNameSpace As Object
Set oOutlook = CreateObject("Outlook.Application")
Set oNameSpace = oOutlook.GetNameSpace("MAPI")
oNameSpace.Logon , , True
Set oMailItem = oOutlook.CreateItem(0)
Set oRecipient = _
om")
oRecipient.Type = 1 '1 = To, use 2 for cc
'keep repeating these lines with
'your names, adding to the collection.
With oMailItem
.Subject = "The extract has finished."
.Body = "This is an automatic email notification"
' .Attachments.Add ("filename") 'you only need this if
'you are sending attachments?
.Display 'use .Send when all testing done
End With
Set oRecipient = False
Set oMailItem = False
Set oNameSpace = False
Set oOutlook = False
--
HTH
Bob Phillips
(replace xxxx in email address with googlemail if mailing direct)
"Ivan" wrote in message
...
Dear all,
I wonder if it is possible to activate MS outlook and send an email to a
specific user with a preset message content in the macro program. Anyone
knows?
Thanks a lot.
Ivan
|