Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
All the Set object = False at the end should be Set object = Nothing
-- HTH Bob Phillips (replace xxxx in email address with googlemail if mailing direct) "Bob Phillips" wrote in message ... 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Another source for this type of information:
http://www.rondebruin.nl/sendmail.htm -- Regards, Tom Ogilvy "Ivan" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
activate macro | Excel Discussion (Misc queries) | |||
Worksheet- activate macro | Excel Discussion (Misc queries) | |||
Lost ability to open (activate) Excel files from Explorer, Outlook | Excel Discussion (Misc queries) | |||
Formula to activate macro | Excel Worksheet Functions | |||
Run Macro on Worksheet Activate | Excel Programming |