# Visual Basic > Visual Basic FAQs >  [FAQ's: OD] How do I show my UserForm at the opening of my document or workbook?

## RobDog888

When needing to run VBA (Macro) code you must make sure to enable Macros to run. Click on Tools > Macro > Security > and select Medium so you can choose to run them or not each time.  :Wink: 


If using Excel then the process would be to use the Workbook_Open event and place a call to show the userform. 

VB Code:
Option Explicit
'Behind ThisWorkbook
 'vbModeless allows you to switch between the worksheet and the userform
'vbModal prevents you from interacting with the worksheet until the userform is dismissed or closed.
Private Sub Workbook_Open()
    UserForm1.Show vbModeless 'Or vbModal
End Sub
If using Word then you would use the Document_Open...

VB Code:
Option Explicit
'Behind ThisDocument
 'vbModeless allows you to switch between the worksheet and the userform
'vbModal prevents you from interacting with the worksheet until the userform is dismissed or closed.
Private Sub Document_Open()
    UserForm1.Show vbModeless 'Or vbModal
End Sub

----------

