How to determine a selected contact


Darren H Gill


I am trying to automate Outlook from Access VBA so that I can open a public
folder and select a contact from it.

My application needs to be able to read information from the public folder
ContactItem object.

I have trid to bind an explorer object declared as
Private WithEvents OutlookExplorer As Outlook.Explorer

I display the explorer from a class method:

Dim oFolder As Outlook.MAPIFolder
Set oFolder = GetOutlookFolderFromID(CStr(FolderID))
Set OutlookExplorer = oFolder.GetExplorer(olFolderDisplayNoNavigation)
Call OutlookExplorer.ShowPane(olFolderList, False)
Call OutlookExplorer.ShowPane(olPreview, False)
Call OutlookExplorer.ShowPane(olPreview, False)


What I then tried to do was read the Explorer Selection collection in the
SelectionChanged event.

Private Sub OutlookExplorer_SelectionChange()
Debug.Print "SElection Changed ..."
If OutlookExplorer.Selection.Count Then
'Process the selected contacts
End If
End Sub

However, My problem seems to be that the event does not fire! Am I missing
something fundamental here?


Darren Gill

Michael Bauer

Hi Darren,

assuming GetOutlookFolderFromID returns the correct folder, did you
check if the class terminates after executing the shown code?

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