[Migrated content. Thread originally posted on 12 July 2006]
I am cycling through the unread emails in the outlook inbox with a program that displays the subject and body of each email:.....
MODIFY olUnreadItems GetFirst() GIVING olMail.
MOVE ZERO TO WS-END.
PERFORM UNTIL WS-END = 1
PERFORM AA-STORE-EMAIL
DISPLAY WS-SUBJECT LINE 4 POS 1
DISPLAY WS-BODY LINE 6 POS 1
ACCEPT WS-DUMMY LINE 8 COL 1
MODIFY olUnreadItems GetNext() GIVING olMail
END-PERFORM.
......
AA-STORE-EMAIL SECTION.
AA-START.
INQUIRE olMail Subject IN WS-SUBJECT.
INQUIRE olMail Body IN WS-BODY.
AA-EXIT.
EXIT.
I have the following exception procedure set up:
DECLARATIVES.
OBJECT-EXCEPTION-HANDLING SECTION.
USE AFTER EXCEPTION ON OBJECT.
OBJECT-EXCEPTION-HANDLER.
MOVE 1 TO WS-END.
END DECLARATIVES.
Unfortunately pressing return to the last unread email on the list just returns the last email again, and doesn't cause the exception procedure to be invoked.
Is there a way of detecting that the last email has been reached? (other than comparing the last and next and checking for changes).
Thanks,
AC.



