Weary Traveler Needs Assistance: Change Focus to Outlook Contacts

C

Cole

I'm trying to give the user a button to push in a spreadsheet to simply
change focus to Outlook Contacts. Everything seems to work except the
very last command - the one to change focus. What am I missing?

Here's what I've got so far:

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")

Set objFolder = objnamespace.GetDefaultFolder(olFolderContacts) ' This
stmt does set objFolder to "Contacts"

objFolder.Display 'This creates a new instance of Outlook
'regardless of whether one is already
'open or not. Take this out, and I get no
'change of focus to Outlook Contacts.

Any help would be greatly appreciated. Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top