Jerry West
2009-02-09 18:03:00 UTC
I'm trying to walk through the MailItems in the Inbox like so:
Dim objItem as Outlook.MailItem
Dim objInbox As Outlook.MAPIFolder
For Each objItem in objInbox.Items
Next objItem
This always fails as objItem always equals Nothing. But when I check the
properties of objInbox in the Watch window I see 133 items are in the Inbox.
Why would this fail? Why wouldn't objItem become initialized as it steps
through the For Loop?
I'm using Outlook 2000. I cannot use a different version of Outlook. I know
this code works because I use it elsewhere. On the machine I'm testing it on
now there were, at one time, two different versions of Outlook installed. I
uninstalled each and re-installed a Outlook 2000. Could artifacts from the
previous installs be causing this issue?
JW
Dim objItem as Outlook.MailItem
Dim objInbox As Outlook.MAPIFolder
For Each objItem in objInbox.Items
Next objItem
This always fails as objItem always equals Nothing. But when I check the
properties of objInbox in the Watch window I see 133 items are in the Inbox.
Why would this fail? Why wouldn't objItem become initialized as it steps
through the For Loop?
I'm using Outlook 2000. I cannot use a different version of Outlook. I know
this code works because I use it elsewhere. On the machine I'm testing it on
now there were, at one time, two different versions of Outlook installed. I
uninstalled each and re-installed a Outlook 2000. Could artifacts from the
previous installs be causing this issue?
JW