![]() |
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. |
Ads |
#2
|
|||
|
|||
![]()
Hi Michael,
I understand your post - but I believe this isn't the case since: (a) The app in question is a test application consisting of one form and the code at the foot of this post -- that's it! You can see that everything is released - there are no other variables or objects in the application. (b) If Outlook was opened by my app and then my app is closed -- I check in Task Manager that my app is no longer running, when I try and manually close Outlook I still get the problem. Therefore it's not my app holding onto something, more it's Outlook not being opened / made visible correctly. Maybe it's something to do with the namespace?! (c) It works fine on Outlook 2000 under Win2K. Thanks again, Gman 'entire code of project Option Explicit Private Sub butClose_Click() Unload Me End Sub Private Sub butGetOutlook_Click() Call OpenOutlook End Sub Sub OpenOutlook() 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 End If End If 'tidy up.... Set myExpl = Nothing Set myNameSpace = Nothing Set oOL = Nothing End Sub |
#3
|
|||
|
|||
![]()
Am Mon, 09 Jan 2006 08:43:21 -0600 schrieb Gman:
Sorry, I donīt know what the problem is. If weird things happen then NAV is often a good point to look at... :-) -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Hi Michael, I understand your post - but I believe this isn't the case since: (a) The app in question is a test application consisting of one form and the code at the foot of this post -- that's it! You can see that everything is released - there are no other variables or objects in the application. (b) If Outlook was opened by my app and then my app is closed -- I check in Task Manager that my app is no longer running, when I try and manually close Outlook I still get the problem. Therefore it's not my app holding onto something, more it's Outlook not being opened / made visible correctly. Maybe it's something to do with the namespace?! (c) It works fine on Outlook 2000 under Win2K. Thanks again, Gman 'entire code of project Option Explicit Private Sub butClose_Click() Unload Me End Sub Private Sub butGetOutlook_Click() Call OpenOutlook End Sub Sub OpenOutlook() 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 End If End If 'tidy up.... Set myExpl = Nothing Set myNameSpace = Nothing Set oOL = Nothing End Sub |
#4
|
|||
|
|||
![]()
OK - I'll take a look at that. Possibly it's just my Outlook
installation. I've had no complaints from clients who use the full application - but then again maybe they haven't noticed... Thanks for getting back to me - I appreciate your time. Gman Michael Bauer wrote: Am Mon, 09 Jan 2006 08:43:21 -0600 schrieb Gman: Sorry, I donīt know what the problem is. If weird things happen then NAV is often a good point to look at... :-) |
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 |