Detecting when the Excel Application has been minimized

sbendbuckeye

Active Member
Joined
Nov 26, 2003
Messages
440
Hello all,

How can I detect the user clicking the Minimize button on the title bar? Thanks in advance for any ideas and/or suggestions!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
I don't know if you can detect the click but you can nquery the window status:

Code:
Sub ReturnWindowState()
    Dim szState As String
    Select Case Application.WindowState
        Case xlMaximized
            szState = "Maximized"
        Case xlMinimized
            szState = "Minimized"
        Case xlNormal
            szState = "Normal"
    End Select
    MsgBox "Window state is: " & szState
End Sub
 

sbendbuckeye

Active Member
Joined
Nov 26, 2003
Messages
440
Hello,

Thanks for the response. I have a custom menu item that needs to run some code when the Excek application itself is minimized or loses focus. The Excel Application events are all WorkBook, WorkSheet or Window events pertaining to inter Excel workings.

I'm guessing I will need to use the API somehow, but I'm not sure where to start. Thanks again!
 

Forum statistics

Threads
1,141,740
Messages
5,708,237
Members
421,553
Latest member
Geeyj

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top