LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Excel Change Focus to Outlook Contacts

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Contacts from Excel to Outlook Ergg Excel Discussion (Misc queries) 1 January 20th 10 10:12 PM
How do I export contacts from Excel back to Outlook Contacts? corvettego Excel Discussion (Misc queries) 2 August 17th 09 06:29 PM
Selected Outlook contacts to excel landshark Excel Discussion (Misc queries) 1 April 17th 07 09:30 PM
Weary Traveler Needs Assistance: Change Focus to Outlook Contacts Cole Excel Discussion (Misc queries) 0 November 6th 06 03:06 PM
Push Button in Outlook to Change Focus to Outlook Contact List Cole Excel Programming 0 October 25th 06 11:29 PM


All times are GMT +1. The time now is 11:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"