David Anson
Posts: 8
Joined: 2004-11-22
|
I am needing to go to a particular folder in Outlook (say the Inbox) and scroll through the e-mails therein and read the subject lines.
I can get so far as even being able to succesfully count the number of items in the folder using {_Items}.Count but then when I try to loop through the items I get stuck.
It works OK the first time through when:
OLItem := OutlookApp.ActiveExplorer.Selection.Item(1)
but when the number increments to 2 I get an array out of bounds error even though the count shows there are 6 items.
Any ideas? :evil: |
|
Dmitry Kostochko
Add-in Express team
Posts: 2887
Joined: 2004-04-05
|
Hello David,
To scan items in a particular folder you don't need to use the Selection collection. Try the following code:
for i := 1 to OutlookApp.ActiveExplorer.CurrentFolder.Items.Count do
begin
OLItem := OutlookApp.ActiveExplorer.CurrentFolder.Items.Item(i);
...
end;
P.S.
Does OutlookApp.ActiveExplorer.Selection.Count return 6? Or does OutlookApp.ActiveExplorer.CurrentFolder.Items.Count return 6?
|
|
David Anson
Posts: 8
Joined: 2004-11-22
|
That has worked gret. Thanks for your help.
David Anson |
|