Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi folks,
I've got code in Excel to see if there's an instance of Outlook running. Problem is, whether it is running or not already, the last command where I'm trying to change focus to Outlook Contacts creates a new instance of Outlook Contacts. Any suggestions on what I'm missing? Greatly appreciated! -Cole - Here my code thus far: ' This is button to change focus to Outlook Contacts: Dim ObjOutlook As Outlook.Application Dim bWasntRunning As Boolean bWasntRunning = False On Error Resume Next ' Try first to use an existing instance. Set ObjOutlook = GetObject(, "Outlook.Application") If Err Then ' Outlook isn't running, so start it. bWasntRunning = True Set ObjOutlook = CreateObject("Outlook.Application") End If Set objnamespace = ObjOutlook.GetNamespace("MAPI") ' Next line does set objFolder to "Contacts" Set objFolder = objnamespace.GetDefaultFolder(olFolderContacts) ' Then this next line is what opens a new instance of Outlook, even if Contacts are already open. objFolder.Display |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Contacts from Excel to Outlook | Excel Discussion (Misc queries) | |||
How do I export contacts from Excel back to Outlook Contacts? | Excel Discussion (Misc queries) | |||
Selected Outlook contacts to excel | Excel Discussion (Misc queries) | |||
Weary Traveler Needs Assistance: Change Focus to Outlook Contacts | Excel Discussion (Misc queries) | |||
Push Button in Outlook to Change Focus to Outlook Contact List | Excel Programming |