Journal Items - Type Mismatch

  • Thread starter Thread starter Simon Woods
  • Start date Start date
S

Simon Woods

Hi

I'm new to all this so bear with me

I've instantiated Outlook, pulled all the items in a particular journal into
a MAPIFolder called m_jnlBugs. I'm applying a filter to the items and want
to enumerate each item. The l_jnlItems seems to be returning the correct
number of Items. The For Each is returning a type mismatch. I've checked
other examples and the types seem to be the same --- what am I missing?

Thanks

Simon

[Outlook 9 OLB]

Sub MyFilter(Byval p_sCategory as String)

Dim l_jnlItems As Outlook.Items
Dim l_jnlItem As Outlook.JournalItem
Dim i As Long

InitialiseExcel

Set l_jnlItems = m_jnlBugs.Items.Restrict("[v5 Function] = '" &
p_sCategory & "'")

'Here we loop through all the items in the JournalFolder and
'collect the data per item
i = 1
For Each l_jnlItem In l_jnlItems
...
Next l_jnlItem

End Sub
 
Does it work if you declare l_jnlItem as Object? If so, try it that way and
use the Class property to determine just what kind of items you actually
have.
 
Thanks Sue

They are all TaskItems so I've changed the declaration --- thanks

However when ever I reference a userproperty of the task item an error
"object required application.activeexplorer"
is generated although the data returned is correct. Could you explain what's
happening ... as I said, I'm new to this

Thanks

Simon


Sue Mosher said:
Does it work if you declare l_jnlItem as Object? If so, try it that way and
use the Class property to determine just what kind of items you actually
have.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Simon Woods said:
Hi

I'm new to all this so bear with me

I've instantiated Outlook, pulled all the items in a particular journal into
a MAPIFolder called m_jnlBugs. I'm applying a filter to the items and want
to enumerate each item. The l_jnlItems seems to be returning the correct
number of Items. The For Each is returning a type mismatch. I've checked
other examples and the types seem to be the same --- what am I missing?

Thanks

Simon

[Outlook 9 OLB]

Sub MyFilter(Byval p_sCategory as String)

Dim l_jnlItems As Outlook.Items
Dim l_jnlItem As Outlook.JournalItem
Dim i As Long

InitialiseExcel

Set l_jnlItems = m_jnlBugs.Items.Restrict("[v5 Function] = '" &
p_sCategory & "'")

'Here we loop through all the items in the JournalFolder and
'collect the data per item
i = 1
For Each l_jnlItem In l_jnlItems
...
Next l_jnlItem

End Sub
 
Back
Top