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.
If using Excel then the process would be to use the Workbook_Open event and place a call to show the userform.
If using Word then you would use the Document_Open...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
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



Reply With Quote