|
-
Nov 10th, 2005, 07:25 AM
#1
Thread Starter
Addicted Member
Outlook instance problem
I am trying to kill outlook instance...
[code]
'Create a reference to namepsace
Dim nmsName As outlook.NameSpace
Set nmsName = objout.GetNamespace("MAPI")
'Create an instance of the sentmail folder
Dim fldfolder As outlook.MAPIFolder
Set fldfolder = nmsName.GetDefaultFolder(outlook.OlDefaultFolders.olFolderSentMail)
[\code]
Code:
Set nmsName = Nothing
Set fldfolder = Nothing
objout.Quit
Set objout = Nothing
Instance is not going...
Or is there any way i can get that outlook application is open?
-
Nov 13th, 2005, 11:04 AM
#2
Re: Outlook instance problem
VB Code:
objout.Logoff
objout.Quit
Set objout = Nothing
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 16th, 2005, 03:01 AM
#3
Thread Starter
Addicted Member
Re: Outlook instance problem
tHERE IS NO PROPERTY AS :
OUTLOOKOBJECT.logoff
[code]
Dim O As New Outlook.Application
Dim C As mapiFolder
Dim M As MAPI.Session
Dim CI As ContactItem
Private Sub Command1_Click()
Set C = O.GetNamespace("MAPI").GetDefaultFolder(olFolderContacts)
For Each CI In C.Items
MsgBox CI.Subject
Set CI = Nothing
Next
On Error Resume Next
Set M = CreateObject("mAPI.Session")
M.Logon
MsgBox O.Name
M.Logoff
Set M = Nothing
O.Quit
Set O = Nothing
End Sub
[\code]
For this small code snippet outlook instance dosn't go...
If i remove for loop its going..
Can anyone tell me why?
Thanks...
-
Nov 16th, 2005, 12:03 PM
#4
Re: Outlook instance problem
I see what your doing here. From your original posted code you didnt have all your object variables defined. Now with your new post it looks like your mixing the API control with the Outlook Object Model. You only need to use one or the other
VB Code:
Private Sub Command1_Click()
Dim oApp As Outlook.Application
Dim oNS As Outlook.Namespace
Dim oFolder As Outlook.MAPIFolder
Dim oContact As Outlook.ContactItem
Set oApp = New OutlookApplication
Set oNS = oApp.GetNamespace("MAPI")
Set oFolder = oNS.GetDefaultFolder(olFolderContacts)
For Each oContact In oFolder.Items
MsgBox oContact.Subject
Set oContact = Nothing
Next
Set oFolder = Nothing
Set oNS = Nothing
oApp.Session.Logoff
oApp.Quit
Set oApp = Nothing
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|