M
Michael Bredbury
I am automating Outlook 2003 version 11.5608.5606 using Visual Basic 6
(SP3) on a Windows XP Pro (SP1) PC. The problem I am having is that
Outlook 2003 will not terminate if I synchronise. I am using the
following code as a test-rig:
Option Explicit
Private Sub Command1_Click()
Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Set objOutlook = New Outlook.Application
Set objNameSpace = objOutlook.GetNamespace("MAPI")
'The next line will prevent Outlook from terminating (try
commenting it out)
objNameSpace.SyncObjects.Item(1).Start
MsgBox "Waiting for the Sync to complete..."
Set objNameSpace = Nothing
objOutlook.Quit
Set objOutlook = Nothing 'Outlook should terminate after this
line!
End Sub
I have tried different code variations inc. using .Stop already.
Should I be doing something else after the line:
'objNameSpace.SyncObjects.Item(1).Start' ?
(My real code traps the SyncEnd, SyncStart, Progress and OnError
events so that it is known when Outlook has finished the Sync).
A manual Sync using Outlook (not automated) works fine.
Cheers
Mike Bredbury
(SP3) on a Windows XP Pro (SP1) PC. The problem I am having is that
Outlook 2003 will not terminate if I synchronise. I am using the
following code as a test-rig:
Option Explicit
Private Sub Command1_Click()
Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Set objOutlook = New Outlook.Application
Set objNameSpace = objOutlook.GetNamespace("MAPI")
'The next line will prevent Outlook from terminating (try
commenting it out)
objNameSpace.SyncObjects.Item(1).Start
MsgBox "Waiting for the Sync to complete..."
Set objNameSpace = Nothing
objOutlook.Quit
Set objOutlook = Nothing 'Outlook should terminate after this
line!
End Sub
I have tried different code variations inc. using .Stop already.
Should I be doing something else after the line:
'objNameSpace.SyncObjects.Item(1).Start' ?
(My real code traps the SyncEnd, SyncStart, Progress and OnError
events so that it is known when Outlook has finished the Sync).
A manual Sync using Outlook (not automated) works fine.
Cheers
Mike Bredbury