none
Problem creating Application WindowResize Event RRS feed

  • Question

  • I try to create a WindowResize Event on Application level. I followed the description here: http://www.cpearson.com/Excel/AppEvent.aspx.

    I’d like to watch the change of the size of the window of the Excel Application and to give a message after a minimized or a normal window is maximized again.

    Following the first method “Application Events In An Existing Object Module” I created the following code on the code area of the Thisworkbook:

    Option Explicit
    Public WithEvents App As Application
    Private Sub Workbook_Open()
        Set App = Application
    End Sub
    Private Sub App_WindowResize(ByVal Wb As Workbook, ByVal Wn As Window)
    If Wn.WindowState = xlMaximized Then MsgBox "Maximize"
    End Sub

    The event works only on Workbook level. That means that after minimizing or setting the workbook size to normal the event reacts by maximizing. But in vain do I change the size of the Excel itself, the event doesn’t react.

    I tried the second method, the “Application Events In A New Class Module” too. The result is the same. The event works only on Workbook level.

    What do I do wrong?


    Tuesday, May 3, 2016 4:02 PM

Answers

All replies