Your First Program

Gain confidence in UI, Objects and Events

I would like to present with list of screens, so that you can do like wise towards your first programme.  Please not that Outlook user interface is changing ever since I started using Outlook, but the procedure remains the same.  For example, Outlook logo changed several times, but the procedure to move to code window doesnot change, and it is Alt + F11.

 

The following screens are from Outlook 2010 Version.

gallery/scr_01_outlook

1. Click on Microsoft Outlook 2010, the following screen is displayed.

2. Press Alt + F11 (Holding the Alt Key down, press F11), the following screen is displayed.

gallery/scr_02_outlook

3. From the above screen, 

  1. Click on "+" symbol before Project1, you get "Microsoft Outlook Objects"
  2. Again Click on "+" symbol, you get "ThisOutlookSession"
  3. Double Click on "ThisOutlook Session", you get the following screen
  4. Move to the right pane, called Code Window.
  5. Click "Application" from left side combo box,
    right combo box gets populated with events list.
  6. Select "NewMailEx" from the right side combo box
  7. The the following line of code
    MsgBox "New Mail arrived.... Please check", vbInformation + vbOKCancel
  8. Click Save button - the title changes to "VBAProject.OTM", this is the name of the file where the code is stored.

This code is automatically executed as and when a new mail arrives into your mail box.

Now, send a mail to yourself and check, if this code is working.

When you receive a new mail, it will display a message box, saying, a new mail has arrived.

 

Likewise, you can write code to any of the given list of events.

gallery/scr_03_eventscreen