IN THIS CHAPTER
Organizing email messages by subject
Listing the next week's appointments
In the previous two chapters, you learned a lot of details about the VBA programming language and the Outlook Object Model. This information is essential, but it can also be a terrific learning aid to see these concepts put into use in a real-world situation. To this end, this chapter presents two complete and tested Outlook VBA applications that perform tasks that Outlook users really might want to perform. You can use these projects as-is, modify them to suit your specific needs, or simply use them as learning aids.
You had an introduction to this project in Chapter 24. This chapter goes into a lot more detail and presents a complete, working application.
At the heart of this application is a VBA function called
MoveMessagesBySubject(). It takes two arguments:
The text that you are searching for
The name of the destination folder
The function's return value is type Boolean. It returns True if the code completes successfully and False if there was a problem. The most likely problem that might occur is that the destination folder cannot be found. However, the function includes error handling code to deal with unforeseen errors.