R
rob
I'm using GetObject to automate an existing instance of Outlook using VBA fro
Excel to open the address book and allow the user to select a group o
recipients
When I do this with Outlook 2007 or 2010 an new Outlook window is opened eac
time the code is run. If I quit the instance of Outlook I'm holding the
Outloo
is shut down completely, regardless of how many windows are showing in th
TaskBar
Repro code is shown below. How can I get this to not open a new Outlook windo
each time it's run? Thanks
Sub ShowAddressList(
Dim objOutlook As Outlook.Applicatio
Dim objNameSpace As Outlook.NameSpac
Dim objDialog As Outlook.SelectNamesDialo
Dim objRecipient As Outlook.Recipien
Set objOutlook = GetObject(, "Outlook.Application"
Set objNameSpace = objOutlook.GetNamespace("MAPI"
Set objDialog = objNameSpace.GetSelectNamesDialo
objDialog.Displa
For Each objRecipient In objDialog.Recipient
Debug.Print objRecipient.Nam
Next objRecipien
Set objDialog = Nothin
Set objNameSpace = Nothin
Set objOutlook = Nothin
End Sub
Excel to open the address book and allow the user to select a group o
recipients
When I do this with Outlook 2007 or 2010 an new Outlook window is opened eac
time the code is run. If I quit the instance of Outlook I'm holding the
Outloo
is shut down completely, regardless of how many windows are showing in th
TaskBar
Repro code is shown below. How can I get this to not open a new Outlook windo
each time it's run? Thanks
Sub ShowAddressList(
Dim objOutlook As Outlook.Applicatio
Dim objNameSpace As Outlook.NameSpac
Dim objDialog As Outlook.SelectNamesDialo
Dim objRecipient As Outlook.Recipien
Set objOutlook = GetObject(, "Outlook.Application"
Set objNameSpace = objOutlook.GetNamespace("MAPI"
Set objDialog = objNameSpace.GetSelectNamesDialo
objDialog.Displa
For Each objRecipient In objDialog.Recipient
Debug.Print objRecipient.Nam
Next objRecipien
Set objDialog = Nothin
Set objNameSpace = Nothin
Set objOutlook = Nothin
End Sub