• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 535
  • Last Modified:

projectwrapper and inspectors- help with Outlook VBA

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.
1 Solution
Script code examples to build from here:
http://www.outlookcode.com (download Sues Code examples)

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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now