Error 91 on last line

L

Lucian Sitwell

I'll excuse my ignorance in advance. I am only starting to program in VBA.

I'm getting error 91 on the last line. No matter what approach I use
(inspector or itemproperties.items.etc. I still get a mismatch). Am I
missing a reference???Lucian Sitwell

Sub Test()
'
' Test Macro
' Macro recorded 12/15/2004 by Lucian Sitwell
'
Dim olApp As Outlook.Application
Dim objContact As Object
Dim objContacts As Outlook.MAPIFolder
Dim objNameSpace As Outlook.NameSpace
Dim objAddress As Object
Dim objInspector As Outlook.Inspector
Dim objExplorer As Outlook.Explorer
Dim objItem As Object

Set olApp = CreateObject("outlook.application")
Set objNameSpace = olApp.GetNamespace("MAPI")
Set objContacts = objNameSpace.GetDefaultFolder(olFolderContacts)
Set objContact = objContacts.Items.Find("[FullName] = ""Doctor's full
name here""")
Set objInspector = olApp.ActiveInspector
objInspector.Display

End Sub
 
M

Michael Bauer

Hi Lucian,

you are getting the error if there´s no ActiveInspector. Do you want to
display objContact? If Items.Find returns a ContactItem then you can
display that item. This displayed item then will result in an
ActiveInspector.

E.g.:

Set objContact = ...
If not objContact Is Nothing Then
objContact.Display
Set objInspector = olApp.ActiveInspector
ELse
MsgBox "No match"
Endif
 
L

Lucian Sitwell

Michael,

Much thanks. My mistake was

objInspector.Display I thought that since the inspector held the object
that it needed to be displayed. Replacement with objContact.Display
worked very well in all of my permutations.

Lucian


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 

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