Re: Outlook instance problem
VB Code:
objout.Logoff
objout.Quit
Set objout = Nothing
:)
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...
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