What is the syntax to clear a listbox?

<listbox name>.Clear

'if clearing a userform's listbox from outside the userform
<userform name>.<listbox name>.Clear
'example
formHome.lstOutput.Clear

 

Advertisements

What is the syntax to change a button’s display text?

 <button name>.Caption = "<new text>"
'example
btnPause.Caption = "Resume"

 

What is the syntax to open a userform in the top-right screen corner?

 Me.StartUpPosition = 0
 Me.Top = Application.Top + 25
 Me.Left = Application.Left + Application.Width - Me.Width - 25
'example - place in UserForm_Activate procedure
Private Sub UserForm_Activate() 'when form opens
   Me.StartUpPosition = 0
   Me.Top = Application.Top + 25
   Me.Left = Application.Left + Application.Width - Me.Width - 25
End Sub

 

What is the syntax to call procedures from another module?

Call <module name>.<sub procedure's name>
#example - project has a userform, and a module called Commands
Private Sub btnRefresh_Click() 'located in a userform
 Call Commands.output
End Sub


Sub output() 'located in Commands module
     MsgBox "This code is in a separate module"
End Sub