What is the syntax to hide Excel and only show userform?

#insert code in ThisWorkbook (under Microsoft Excel Objects in IDE)
Private Sub Workbook_Activate()
     <userform name>.Show
End Sub

#insert code in userform's code
Private Sub UserForm_Initialize()
     Application.Visible = False
End Sub
 
Private Sub UserForm_Terminate()
     Application.Visible = True
End Sub
#example

#in ThisWorkbook object
Private Sub Workbook_Activate()
 frmHome.Show
End Sub

#in userform, frmHome
Private Sub UserForm_Initialize()
 Application.Visible = False
End Sub
 
Private Sub UserForm_Terminate()
 Application.Visible = True
End Sub

 

Advertisements