hide excell when using vba forms

ecoscientist

New Member
Joined
Apr 4, 2002
Messages
12
Does anyone know if there is a way to hide the entire excel window or to minimize it so that only a userform will be seen on the desktop?
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
This makes excel not hide but minimized:

Private Sub UserForm_Activate()
Application.WindowState = xlMinimized
End Sub

Private Sub UserForm_Deactivate()
Application.WindowState = xlNormal
End Sub


And you should use

UserForm1.Show vbModeless

to show userform

regards
 
Upvote 0
You can set Userform's Showmodal property to false in design view_properties window if you dont want to use UserForm1.Show vbModeless. Just same...
 
Upvote 0
If you are not closer to APIs then this should be a little confused what it does but just does what you want.

Open the user form module and paste this codes.

'These two lines should be placed on declaration
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Dim currState

Private Sub UserForm_Activate()
currState = Application.WindowState
Call MinimizeAll
Application.WindowState = currState
Application.WindowState = xlMinimized
UserForm1.Show vbModeless
End Sub

Private Sub MinimizeAll()
Call keybd_event(&H5B, 0, 0, 0)
Call keybd_event(77, 0, 0, 0)
Call keybd_event(&H5B, 0, &H2, 0)
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Application.WindowState = currState
End Sub

regards
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,927
Members
448,533
Latest member
thietbibeboiwasaco

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
Back
Top