none
How to fire an event when Excel itself lose focus RRS feed

  • Question

  • I know how to detect which window is activated (with user32.dll function) but not how to fire an event…

    WindowDeactivate event fired only when the application closed.

    
    

     
    Sunday, July 24, 2016 5:46 AM

All replies

  • Hi Refael1001,

    please visit link below will give you example of Application.Deactivated Event.

    Application.Deactivated Event

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, July 25, 2016 1:47 AM
    Moderator
  • Thanks for the quick reply,

    I already tried using the supplied events (for ThisWorkbook or sheet classes), but as I mentioned earlier it doesn't work when the application stops being the foreground application...

    and for the Instructions in the link you provide, This causes to conflict between (Imports) Microsoft.Office.Interop.Excel and (Imports) System.Windows  -

    " 'Application' is ambiguous "

    So I tried to make a new class only with (Imports) System.Windows and nothing.


    • Edited by Refael1001 Monday, July 25, 2016 8:09 AM
    Monday, July 25, 2016 8:06 AM
  • Hi Refael1001,

    in the original post you had mentioned that,"WindowDeactivate event fired only when the application closed. "

    let me tell you that these two events only fires when you switch the window with in Application.

    like you switch to One Excel Window to another Excel Window at that time it will executed.

    but it will not execute if you switch the window to another Application like word or powerpoint or it can be any thing.

    so these events works only with in the Application.

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, July 26, 2016 7:16 AM
    Moderator