Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Activate MS Outlook in macro?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Activate MS Outlook in macro?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Activate MS Outlook in macro?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
activate macro Jase Excel Discussion (Misc queries) 1 June 9th 08 08:25 PM
Worksheet- activate macro sarah Excel Discussion (Misc queries) 3 March 21st 07 04:44 PM
Lost ability to open (activate) Excel files from Explorer, Outlook Henny Excel Discussion (Misc queries) 1 November 29th 05 05:00 PM
Formula to activate macro coal_miner Excel Worksheet Functions 5 September 20th 05 04:56 AM
Run Macro on Worksheet Activate Matthew John Antoszkiw Excel Programming 2 February 23rd 04 12:01 PM


All times are GMT +1. The time now is 06:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"