projectwrapper and inspectors- help with Outlook VBA

Posted on 2009-04-16
Last Modified: 2012-05-06
I am trying to get the inspectors event to look for two different activities, is this the correct code

Option Explicit
Dim WithEvents inspectors As inspectors
Dim WithEvents project As TaskItem
Dim root As folder

Private Sub Application_Startup()
    Set inspectors = Application.inspectors
    Set root = Application.Session.Folders("Business Contact Manager")
    Set project = root.Folders("Business Projects").items(1)
End Sub
Private Sub inspectors_NewInspector(ByVal inspector As inspector)
    If inspector.CurrentItem.Class <> olTask Then Exit Sub
    Dim oTaskItem As TaskItem
    Set oTaskItem = inspector.CurrentItem
    If oTaskItem.MessageClass <> "IPM.Task.BCM.Project" Then Return
    Dim oProjectWrapper As New ProjectWrapper
    oProjectWrapper.Init inspector
    If oTaskItem.MessageClass <> "IPM.Task.BCM.ProjectTask" Then
    Dim oTaskWrapper As New ProjectWrapper
    oTaskWrapper.Init inspector
End Sub

I did have a second Return after Then from the ProjectTask bit but it threw an error.
Should my class modules be called ProjectWrapper and TaskWrapper or have I got it all a bit confused?

Thanks Ed.
Question by:edmacey
    LVL 28

    Accepted Solution

    Script code examples to build from here: (download Sues Code examples)


    Author Closing Comment

    Thanks PeakPeak, I have actually now accomplished this and did intend just to cancel the question. I have often visited which is why I only put good for the grade. Ed.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Email signatures have numerous marketing benefits. Here are 8 top reasons to turn your email signature into a marketing channel.
    Create high volume marketing opportunities using email signatures with these top 10 DOs and DON'Ts of email signature marketing.
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now