Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Part 6: Programming the Office Applications > Working with Events in Outlook

Chapter 27. Working with Events in Outlook

If you want to automate the way that Outlook works, you may sometimes need to write code that responds to Outlook events. Outlook has two classes of events, application-level events and item-level events, and between them, they enable you to write code that responds to most occurrences in Outlook. In this chapter, you will learn how to work with both types of events, and you will see code examples showing how to manage some of the events.

How Event Handler Procedures Differ from Ordinary Macros

Both the construction of an event handler procedure and its testing differ somewhat from the techniques you've been employing throughout this book when creating and testing ordinary macro procedures. To summarize: An event handler must be located within a class module, not in an ordinary macro module; an object variable must be declared, and then initialized to point to the event handler procedure; and you cannot simply test the event handler by pressing F5 to run it directly (you run it indirectly by triggering the event it's designed to service, for example by modifying a contact in the Contacts folder). A complete example demonstrating how to add an event handler to Outlook, and then test it can be found in the sidebar titled "How to Test Event Handler Procedures" later in this chapter.



  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint