Simple: When programs are minized...

Hello, I want to be able to run some code when the user minimizes the program, i know this can be done because it happens on a lot of programs.  I want to hide the form when this happens because it resedents in the system tray.  So all i need is how to figure out when it is minized.

Thanks...
clear100-comAsked:
Who is Participating?
 
___XXX_X_XXX___Connect With a Mentor Commented:
Private Sub Form_Resize()

If Me.WindowState = vbMinimized Then
   MsgBox "Run your code here"
End If

End Sub
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Private Sub Form_Resize()
    If Me.WindowState = vbMinimized Then
        Me.Hide
    End If
End Sub

DON'T ACCEPT THIS AS AN ANSWER!!!

Accept the solution from ___XXX_X_XXX___

Idle_Mind


0
 
clear100-comAuthor Commented:
see i knew this, but i just was too tired or somthing, thanks.!!!
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
___XXX_X_XXX___Commented:
Idle_Mind,
Why not to accept your code ? It's correct solution also.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Because I just changed one line in your code which I think clear100-com would have known to do.  Your answer had the main part of the solution...my poor brain just couldn't leave the question without posting the complete answer.

You posted first so I felt you should get the points.

Idle_Mind
0
 
___XXX_X_XXX___Commented:
:) 10x
0
All Courses

From novice to tech pro — start learning today.