View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
PaulC PaulC is offline
external usenet poster
 
Posts: 1
Default E-mailing from Excel 2003 problem


I am running the following macro from Excel (2003) to send an e-mail
from Outlook. When the e-mail has gone I want to be returned to Excel.
This worked fine in Excel 97, but with Excel 2003, Outlook always
remains on top at the end. What do I need to add to bring Excel backto
the front? (The YesClickmacros work okay.)

Paul


Sub SendEmailFromExcel()

Dim oOut1 As New Outlook.Application
Dim oNS As Outlook.NameSpace
Dim oMail As Outlook.MailItem

Set oNS = oOut1.GetNamespace("MAPI")
oNS.Logon
Set oMail = oOut1.CreateItem(olMailItem)

ResumeYesClickMacro

With oMail
..Subject = "Changes to Client Details....."
..Recipients.Add "
..Send
End With

oNS.Logoff
Set oNS = Nothing

SuspendYesClickMacro

End Sub


--
PaulC
------------------------------------------------------------------------
PaulC's Profile: http://www.excelforum.com/member.php...fo&userid=7563
View this thread: http://www.excelforum.com/showthread...hreadid=501741