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

What is the syntax to load an image?

<image control name>.Picture = LoadPicture(<file path in string form>)
'examples
profileImg.Picture = LoadPicture("C:\Users\john\Documents\johnsface.jpg")

strPath = "C:\Users\bob\Pictures\Landscapes\picoftrees.jpg"
image1.Picture = LoadPicture(strPath)

 

Helpful Tips

  • To add an Image Control, directly drag an Image from the Toolbox menu onto your UserForm.
  • To change the name of an Image Control, go to the Properties window in the UserForm Editor and change the name under field “(Name)”.
  • If you do not see your Toolbox or Properties window, go to the top under View and toggle your visibility settings
  • To find the string filepath for your image, you may find this article helpful: How do I find the filepath for a folder?