Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Mar 2006
    Thanked 0 Times in 0 Posts

    Writing macros in Outlook (2003 or 2007)

    I'm experienced at writing VB macros in Word (albeit, self-taught), but can't seem to get started writing them in Outlook. Is there an online resource somewhere on getting started? At this stage I'm just trying to develop a macro that warns me if the email I'm sending contains the string "attach", but I can't even work out what the object is for "active-mail-item-which-is-in-the-process-of-being-sent".

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Writing macros in Outlook (2003 or 2007)

    You can search our Outlook forum for example code.

    OutlookCode.Com contains a wealth of information on programming Outlook.

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Salt Lake City, Utah, USA
    Thanked 6 Times in 6 Posts

    Re: Writing macros in Outlook (2003 or 2007)

    The site that Hans mentions is run by Sue Mosher, an MS Outlook MVP, and her book Microsoft Outlook Programming, Jumpstart ..., 2003, rev 2007, Digital Press (Elsevier Science), is a good Outlook VBA starter book. The Outlook Object Model is very different from most other MS apps, and takes some getting used to. As Hans notes, most of the Lounge discussion on Outlook VBA is in the Outlook Forum.

    Regarding your question, use the ItemSend Event, which is found under the ThisOutlookSession Module, a kind of Event/Class Module for Outlook, this starter example is untested "air code":

    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    With Item
    If CBool(instr(.Body, "Attach")) Then ...
    -John ... I float in liquid gardens
    UTC -7ąDS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts