Programming Microsoft Outlook and Microsoft Exchange, Second Edition (DV-MPS Programming)

While creating forms and actions in the last two chapters, you might have wondered what the View Code option on the Form menu did. If you had selected the View Code command, the Outlook Script Editor would have appeared, showing you firsthand how VBScript is integrated with Outlook. Figure 6-1 shows the Script Editor displaying code from a sample application.

Figure 6-1 The integrated Outlook Script Editor.

The Script Editor allows you to add custom VBScript procedures and variables to your Outlook applications as well as use Outlook objects in your applications. Using the Script Editor, you can write VBScript to handle Outlook events. The Script Editor provides an Insert Event Handler dialog box, which lets you select the event you want to write a handler for. We'll discuss Outlook events more later in this chapter.

Outlook provides line numbers when reporting errors, and in the Script Editor, you can jump to a specific line of code. This feature makes it easier to debug any errant code in your application. To use this functionality, in the Script Editor, select Go To from the Edit menu, specify the line number, and click OK. Your cursor will be inserted at the specified line.

Категории