none
activate event not so active RRS feed

  • Question

  • I exchanged the "newinspector" event for the "activate" event - not much of an improvement. In the code below

    Private Sub thsinsp_activate()
        'MsgBox ("enter activate event handler")
        Dim objItem As Object
        Set objItem = Application.ActiveInspector.CurrentItem

        lots of code below

    If I comment out the msgbox an error 91 occurs when I attempt to set objItem.  If I turn the msgbox code on (remove the comment apostrophe) the error goes away leaving me to surmise that the activate event is premature in its firing - it requires a "settling" period.

    I am still using the newinspector event to "set" the activate event (and nothing else).  The bulk of the "mission" code is in the activate event handler not the newinspector event handler.

    Any insights would be greatly appreciated.


    Gordon Haas

    Monday, March 26, 2012 8:21 PM

Answers

  • Why do you need Application.ActiveInspector if you are using Inspector.Activate event? If you set up the event handler, you already know which Inspector object you are operating on, so there is no need to use Application.ActiveInspector.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!

    • Marked as answer by saahg Tuesday, March 27, 2012 2:23 AM
    Monday, March 26, 2012 8:44 PM
  • ActiveInspector doesn't change until *after* the Activate() event, which actually makes sense. Just use the Inspector you're handling in Activate(), it's what you want anyway.

    --
    Ken Slovak
    MVP - Outlook
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
     
     
    "saahg" <=?utf-8?B?c2FhaGc=?=> wrote in message news:70c57617-cf72-4754-9d85-443c33f863f0...

    I exchanged the "newinspector" event for the "activate" event - not much of an improvement. In the code below

    Private Sub thsinsp_activate()
        'MsgBox ("enter activate event handler")
        Dim objItem As Object
        Set objItem = Application.ActiveInspector.CurrentItem

        lots of code below

    If I comment out the msgbox an error 91 occurs when I attempt to set objItem.  If I turn the msgbox code on (remove the comment apostrophe) the error goes away leaving me to surmise that the activate event is premature in its firing - it requires a "settling" period.

    I am still using the newinspector event to "set" the activate event (and nothing else).  The bulk of the "mission" code is in the activate event handler not the newinspector event handler.

    Any insights would be greatly appreciated.


    Gordon Haas


    Ken Slovak MVP - Outlook
    • Marked as answer by saahg Tuesday, March 27, 2012 2:23 AM
    Monday, March 26, 2012 8:57 PM
    Moderator

All replies

  • Why do you need Application.ActiveInspector if you are using Inspector.Activate event? If you set up the event handler, you already know which Inspector object you are operating on, so there is no need to use Application.ActiveInspector.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!

    • Marked as answer by saahg Tuesday, March 27, 2012 2:23 AM
    Monday, March 26, 2012 8:44 PM
  • ActiveInspector doesn't change until *after* the Activate() event, which actually makes sense. Just use the Inspector you're handling in Activate(), it's what you want anyway.

    --
    Ken Slovak
    MVP - Outlook
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
     
     
    "saahg" <=?utf-8?B?c2FhaGc=?=> wrote in message news:70c57617-cf72-4754-9d85-443c33f863f0...

    I exchanged the "newinspector" event for the "activate" event - not much of an improvement. In the code below

    Private Sub thsinsp_activate()
        'MsgBox ("enter activate event handler")
        Dim objItem As Object
        Set objItem = Application.ActiveInspector.CurrentItem

        lots of code below

    If I comment out the msgbox an error 91 occurs when I attempt to set objItem.  If I turn the msgbox code on (remove the comment apostrophe) the error goes away leaving me to surmise that the activate event is premature in its firing - it requires a "settling" period.

    I am still using the newinspector event to "set" the activate event (and nothing else).  The bulk of the "mission" code is in the activate event handler not the newinspector event handler.

    Any insights would be greatly appreciated.


    Gordon Haas


    Ken Slovak MVP - Outlook
    • Marked as answer by saahg Tuesday, March 27, 2012 2:23 AM
    Monday, March 26, 2012 8:57 PM
    Moderator
  • This reply is for both Ken and Dimitry - Thanks guys.

    I did realize that I could use thsInsp.currentitem to effect setting of objItem.  I was trying to see if application.activeinspector would be exposed at the activate event since it was not at the newinspector event.  Ken confirmed my suspicion that the application.activeinspector needed some time AFTER the activate event to be "exposed" and now I realize that, that is the case.  I am documenting these subtleties as I digest this new programming paradigm and this is the reason why I am experimenting.  Again thanks for your help.


    Gordon Haas

    Monday, March 26, 2012 10:05 PM