![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Am Fri, 06 Jan 2006 08:59:26 -0600 schrieb Gman:
If the user canīt quit OL then your app is still running - or any other app that holds at least one ref on OL. You need to check your code that really nothing remains alive. A popular mistake e.g. is not to unload a form. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Hi Michael, Thanks for your response. Unfortunately, if I use myExpl.Close then oOL.Application.Quit and then I release any objects associated with Outlook Set myFolder = Nothing Set myExpl = Nothing Set myNameSpace = Nothing Set oOL = Nothing it still doesn't allow my application to kill Outlook. Also, I'm not really looking to kill Outlook from my application (although I would like to be able to do this). Rather, when I need to send emails, I want to open up Outlook (if it's not already open) and send them, leaving it open for the user. If the user closes my application, I would prefer to leave Outlook running - they may well be using it. But when they come to close Outlook themselves, it won't close if I created the instance -- even if my application is no longer open. Thanks Revised code: Sub OpenOutlook2() Dim oOL As Object Dim myNameSpace As Object, myExpl As Object 'Try and get an active instance: On Error Resume Next Set oOL = GetObject(, "Outlook.Application") On Error GoTo 0 If oOL Is Nothing Then 'try and create a new instance Set oOL = CreateObject("Outlook.Application") If Not oOL Is Nothing Then Set myNameSpace = oOL.GetNamespace("MAPI") Set myExpl = _ oOL.Explorers.Add(myNameSpace.GetDefaultFolder(6), 0) 'olFolderInbox,'olFolderDisplayNormal myExpl.Activate MsgBox "opening...." End If End If If MsgBox("Outlook created = " & (oOL Is Nothing) _ & vbCrLf & "Wanna close?", vbYesNo) = vbYes Then myExpl.Close oOL.Application.Quit End If 'tidy up.... Set myExpl = Nothing Set myNameSpace = Nothing Set oOL = Nothing End Sub Michael Bauer wrote: Am Thu, 05 Jan 2006 22:32:28 -0600 schrieb Gman: I think, closing the Explorer by code, if you created the OL instance, should do it. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook 2003 does not close down correctly.. No info why | SusanDes | Outlook - Installation | 1 | February 20th 06 07:01 PM |
Outlook 2003 fires an Inspector Close when a send is cancelled | Steve D | Add-ins for Outlook | 8 | February 8th 06 11:22 PM |
Cannot close archive.pst folder in Outlook 2003 | Clark | Outlook - General Queries | 2 | January 31st 06 08:27 AM |
outlook folders can not be opened | chris the badger | Outlook - Installation | 2 | January 23rd 06 09:13 PM |
Calendar... Button opens another Outlook Instance ... | Sue Mosher [MVP-Outlook] | Outlook - Calandaring | 0 | January 19th 06 09:09 PM |