Two questions

J

Jacek

Hello
Please help me, bacuse I spent a lot of time on it and
have no idea why it doesn't work
1. In all examples there is as follows:

For Each objForm In objFolder.Items

Next objFolder
(where objFolder is defalut contact folder, and objForm
contact item)
But I got an error: Expression is of type 'Outlook.Items',
which is not a collection type.
Why ???

2. I would like to add some code when each contact item is
opening (displaying), but when I have declaration:
Private WithEvents objForm As Outlook.ContactItem
and then:
Private Sub objForm_Open(ByRef Cancel As Boolean) Handles
objForm.Open
It doesn't work. Why??
when I add in onConecction:
objForm = objFolder.Items.Item - there is parametr needed,
but when objForm = objFolder.Items.Item(1), it only works
with Item(1)
I do not use dual class method. Is it any difference?
Thank You in advance fo each help.
brgds
Jacek
 
K

Ken Slovak - [MVP - Outlook]

I'm not quite sure what you are asking in your second question.
However, a contacts folder can hold distribution lists also and if you
assign a ContactItem to a DL item you will get an error. Use an Object
and then test it to see if it's a contact or DL. For the second
question please clarify if the object type isn't the cause of that
problem too.
 

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