View Single Post
  #1  
Old June 12th 09, 08:26 AM posted to microsoft.public.office.developer.outlook.vba,microsoft.public.outlook.program_vba
Rod[_5_]
external usenet poster
 
Posts: 2
Default Outlook staying in memory

I am running a VBA program in Access to send emails. The email is sent OK
but Outlook stays in memory.
In the code below I have put in a message box to slow the code down. If this
is there then Outlook correctly closes itself down.
Because it is not closed it creates problems the next time I call the code,
even if it is modified to pick up an already open version of outlook.

I am using Office 2002 on a Vista machine with several cpus

Any suggestions please

many thanks


--------------------------------


Public Sub Create_eMails()

Dim olApp As New Outlook.Application
Dim olNs As Outlook.NameSpace
Dim OBmailItem As Outlook.MailItem

Set olApp = New Outlook.Application

Set olNs = olApp.GetNamespace("MAPI")
olNs.Logon ""

Set OBmailItem = olApp.CreateItem(olMailItem)

OBmailItem.To = "

OBmailItem.Subject = "Test Email. "
OBmailItem.Body = "Test Body Text "
OBmailItem.Send

Call MsgBox("Wait")

olNs.Logoff

olApp.Quit

Set OBmailItem = Nothing
Set olNs = Nothing
Set olApp = Nothing

End Sub


Ads