Events Listing for Form Objects (Word VBA):   Return to List

' Events Listing for Form Objects (the Underscore shows what's described
    further down with greater detail -- specific control declarations)

' -------------- EVENTS shown below --------------------
' -------------- SELECT & SEARCH TO SEE WHAT OBJECTS IT APPLIES TO ----
' _AddControl(ByVal Control As MSForms.Control)
' _AfterUpate() . . . Events for form objects
' _BeforeDragOver(...)
' _BeforeDropOrPaste(...)
' _BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
' _Change()
' _Click()
' _DblClick(ByVal Cancel As MSForms.ReturnBoolean)
' _DropButtonClick()
' _Enter()
' _Error(...)
' _Exit(ByVal Cancel As MSForms.ReturnBoolean)
' _KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
' _KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
' _KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
' _MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
' _MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
' _MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
' Frame1_Layout()
' Frame1_RemoveControl(ByVal Control As MSForms.Control)
' Frame1_Scroll(ByVal ActionX As Long, ByVal ActionY As Long, ByVal RequestDx As Single, _
    ByVal RequestDy As Single, ByVal ActualDx As MSForms.ReturnSingle, _
    ByVal ActualDy As MSForms.ReturnSingle)
' Frame1_Zoom(Percent As Integer)
' MonthView1_DateClick(ByVal DateClicked As Date)
' MonthView1_DateDblClick(ByVal DateDblClicked As Date)
' MonthView1_GetDayBold(ByVal StartDate As Date, ByVal Count As Integer, State() As Boolean)
' MonthView1_OLECompleteDrag(Effect As Long)
' MonthView1_SelChange(ByVal StartDate As Date, ByVal EndDate As Date, Cancel As Boolean)
' MultiPage1_Layout(ByVal Index As Long)
' MultiPage1_RemoveControl(ByVal Index As Long, ByVal Control As MSForms.Control)
' MultiPage1_Scroll(ByVal Index As Long, ByVal ActionX As Long, ByVal ActionY As Long, _
    ByVal RequestDx As Single, ByVal RequestDy As Single, ByVal ActualDx _
    As MSForms.ReturnSingle, ByVal ActualDy As MSForms.ReturnSingle)
' MultiPage1_Zoom(ByVal Index As Long, Percent As Integer)
' ScrollBar1_Scroll()
' SpinButton1_SpinDown()
' SpinButton1_SpinUp()
' TreeView1_AfterLabelEdit(Cancel As Integer, NewString As String) Events for form objects
' TreeView1_BeforeLabelEdit(Cancel As Integer)
' TreeView1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
' UserForm_Activate()
' UserForm_Deactivate()
' UserForm_Initialize()
' UserForm_Layout()
' UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
' UserForm_RemoveControl(ByVal Control As MSForms.Control)
' UserForm_Resize()
' UserForm_Scroll(ByVal ActionX As Long, ByVal ActionY As Long, ByVal RequestDx As _
    Single, ByVal RequestDy As Single, ByVal ActualDx As _
    MSForms.ReturnSingle, ByVal ActualDy As MSForms.ReturnSingle)
' UserForm_Terminate()
' UserForm_Zoom(Percent As Integer)

' NOTE: Values are returned when something inside the parenthesis
'     The skeleton event would contain the code below followed by "End Sub"
' ------------------------------------------
' ----- _AddControl(ByVal Control As MSForms.Control)
' ------------------------------------------
' Frame1_, MultiPage1_, UserForm_
' ---------------------
' Example shown below -
' Private Sub UserForm_AddControl(ByVal Control As MSForms.Control)
    ' Not sure how to program this.
' End Sub

' ------------------------------------------
' ----- _AfterUpate() Events for form objects
' ------------------------------------------
' CheckBox1_, ComboBox1_, ListBox1_, MonthView1_, OptionButton1_, SBProgress1_
' ScrollBar1_, SpinButton1_, TextBox1_, ToggleButton1_, TreeView1_
' ---------------------
' Example shown below -
' Private Sub CheckBox1_AfterUpdate()
'     MsgBox "Checkbox1 has been updated!"     ' Which will show after checkbox clicked on or off.
' End Sub
' Private Sub ToggleButton1_AfterUpdate()
'     MsgBox "ToggleButton1 has been updated!" ' Which will show after toggle
                                    button clicked on or off.
' End Sub
' Private Sub OptionButton1_AfterUpdate()
'     MsgBox "OptionButton1 has been updated!"    ' Which will show after option button _
                                    clicked -- though it must change state!
' End Sub

' ------------------------------------------
' ---_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, ByVal Data As _
    MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal DragState As Long, _
    ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer) Events for form objects
' ------------------------------------------
' CheckBox1_, ComboBox1_, CommandButton1_, Frame1_, Image1_, Label1_, ListBox1_, MultiPage1_
' OptionButton1_, ScrollBar1_, SpinButton1_, TabStrip1_, TextBox1_, ToggleButton1_, UserForm_
' ---------------------
' Example shown below -
' Private Sub CheckBox1_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, ByVal Data As _
    MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal DragState As Long, _
    ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
    ' Not sure how to program this.
' End Sub

' ------------------------------------------
' --- _BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As Long, _
        ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, _
        ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
' ------------------------------------------
' CheckBox1_, ComboBox1_, CommandButton1_, Frame1_, Image1_, Label1_, ListBox1_
' MultiPage1_, ScrollBar1_, SpinButton1_, TabStrip1_, TextBox1_, ToggleButton1_, UserForm_

' -----------------------------------
' --- _BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
' ------------------------------------------
' CheckBox1_, ComboBox1_, ListBox1_, MonthView1_, OptionButton1_
' SBProgress1_, ScrollBar1_, SpinButton1_, ToggleButton1_
' ---------------------
' Example shown below -
' Private Sub CheckBox1_BeforeUpdate(ByVal Temp As MSForms.ReturnBoolean)
'     MsgBox "This is before CheckBox1 Update " & Temp ' Immediately before a change of _
                                        state and the Temp is False
' End Sub

' ------------------------------------------
' --- _Change()
' ------------------------------------------
' CheckBox1_, ComboBox1_, ListBox1_, MultiPage1_, OptionButton1_
' ScrollBar1_, SpinButton1_, TabStrip1_, TextBox1_, ToggleButton1_
' ---------------------
' Example shown below -
' Private Sub CheckBox1_Change()
'     MsgBox "CheckBox1 has changed!"     ' This also displays when checkbox clicked on or off.
' End Sub

' ------------------------------------------
' --- _Click()
' ------------------------------------------
' CheckBox1_, ComboBox1_, CommandButton1_, Frame1_, Image1_, Label1_, ListBox1_, MonthView1_
' MultiPage1_, OptionButton1_, SBProgress1_, TabStrip1_, ToggleButton1_, TreeView1_UserForm_

' ------------------------------------------
' --- _DblClick(ByVal Cancel As MSForms.ReturnBoolean)
' ------------------------------------------
' CheckBox1_, ComboBox1_, CommandButton1_, Frame1_, Image1_, Label1_, ListBox1_
' MonthView1_, MultiPage1_, OptionButton1_, SBProgress1_, TabStrip1_, TextBox1_
' ToggleButton1_, TreeView1_, UserForm_

' ------------------------------------------
' --- _DropButtonClick()
' ------------------------------------------
' ComboBox1_, TextBox1_

' ------------------------------------------
' --- _Enter()
' ------------------------------------------
' CheckBox1_, ComboBox1_, CommandButton1_, Frame1_, ListBox1_, MonthView1_, MultiPage1_
' OptionButton1_, SBProgress1_, ScrollBar1_, SpinButton1_, TabStrip1_, TextBox1_, ToggleButton1_,
TreeView1_Enter()
' ---------------------
' Example shown below -
' Private Sub CheckBox1_Enter()
'    MsgBox "I've entered CheckBox1!"    ' Will display message when CheckBox1 has focus
' End Sub

' ------------------------------------------
' --- _Error(ByVal Number As Integer, ByVal Description As MSForms.ReturnString, _
    ByVal SCode As Long, ByVal Source As String, ByVal HelpFile As String, _
    ByVal HelpContext As Long, ByVal CancelDisplay As MSForms.ReturnBoolean)
' ------------------------------------------
' CheckBox1_, ComboBox1_, CommandButton1_, Frame1_, Image1_, Label1_, ListBox1_, MultiPage1_
' OptionButton1_, ScrollBar1_, SpinButton1_, TabStrip1_, TextBox1_, ToggleButton1_, UserForm_

' ------------------------------------------
' --- _Exit(ByVal Cancel As MSForms.ReturnBoolean)
' ------------------------------------------
' CheckBox1_, ComboBox1_, CommandButton1_, Frame1_, ListBox1_, MonthView1_, MultiPage1_
' OptionButton1_, SBProgress1_, ScrollBar1_, SpinButton1_, TabStrip1_, TextBox1_, TreeView1_,
ToggleButton1_
' ---------------------
' Example shown below -
' Private Sub CheckBox1_Exit(ByVal Temp As MSForms.ReturnBoolean)
'    MsgBox "I've exited CheckBox1! " & Temp ' Will display message when CheckBox1 loses focus &
                                                Temp will be "False"
' End Sub

' ------------------------------------------
' --- _KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
' ------------------------------------------
' CheckBox1_, ComboBox1_, CommandButton1_, Frame1_, ListBox1_, MonthView1_, MultiPage1_
' OptionButton1_, SBProgress1_, ScrollBar1_, SpinButton1_, TabStrip1_, TextBox1_, ToggleButton1_
' TreeView1_, UserForm_
' ---------------------
' Example shown below - -- MyKeyCode has the ascii code of the capital letter of whatever
'        Key is pressed -- and a 1 (if the shift key is pressed) or a 0 (if shift key not pressed)
'         -- Of course, CheckBox1 must have the Focus for this event to register anything.
'Private Sub CheckBox1_KeyDown(ByVal MyKeyCode As MSForms.ReturnInteger, ByVal MyShift As Integer)
'    MsgBox "Checkbox1 keydown of letter " & Chr(MyKeyCode) & " is " & MyKeyCode & _
    " and the shift is " & MyShift
'End Sub

' ------------------------------------------
' --- _KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
' ------------------------------------------
' CheckBox1_, ComboBox1_, CommandButton1_, Frame1_, ListBox1_, MonthView1_, MultiPage1_, ToggleButton1_
' OptionButton1_, SBProgress1_, ScrollBar1_, SpinButton1_, TabStrip1_, TextBox1_, TreeView1_, UserForm_
' ---------------------
' Example shown below - -- When CheckBox1 has the focus this shows the ascii code of the key pressed
'                                         -- whether capital letter or small letter.
'Private Sub CheckBox1_KeyPress(ByVal Temp As MSForms.ReturnInteger)
'    MsgBox "CheckBox1 KeyPress function of letter " & Chr(Temp) & " shows ascii code of " & Temp
'End Sub

' ------------------------------------------
' --- _KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
' ------------------------------------------
' CheckBox1_, ComboBox1_, CommandButton1_, Frame1_, ListBox1_, MonthView1_, MultiPage1_, OptionButton1_
' SBProgress1_, ScrollBar1_, SpinButton1_, TabStrip1_, TextBox1_, ToggleButton1_, TreeView1_, UserForm_

' ------------------------------------------
' --- _MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
' ------------------------------------------
' CheckBox1_, ComboBox1_, CommandButton1_, Frame1_, Image1_, Label1_, ListBox1_, MonthView1_, MultiPage1_
' OptionButton1_, SBProgress1_, TabStrip1_, TextBox1_, ToggleButton1_, TreeView1_, UserForm_
' ---------------------
' Example shown below - -- This returns number 1 for MyButton if Left-Click or 2 if Right-Click
'     -- Will only returns values if clicked within CheckBox1's area (though need not be in checkbox)
'     -- Will also return 0 or 1 depending on whether the shift key is pressed.
' Private Sub CheckBox1_MouseDown(ByVal MyButton As Integer, ByVal MyShift As Integer, _
                                                             ByVal MyX As Single, ByVal MyY As Single)
'    MsgBox "CheckBox1 has focus and Mouse pressed returning " & MyButton & " as button " & MyShift & _
                    " as shift key " & MyX & " as X coordinate " & MyY & " as Y coordinate."
' End Sub

' Slider Control Example
'Private Sub Form_Load()
'    Slider1.TooltipText = Str(Slider1.Value)
'    Slider1.Min = 0
'    Slider1.Max = 100
'    Slider1.TickFrequency = 10
'    Form1.Caption = "Form Size Adjustment in Percent (%)"
'    Slider1.TextPosition = sldBelowRight
'End Sub
'
' ------------------------------------------
' --- _MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
' ------------------------------------------
' CheckBox1_, ComboBox1_, CommandButton1_, Frame1_, Image1_, Label1_, ListBox1_, MonthView1_, MultiPage1_
' OptionButton1_, SBProgress1_, TabStrip1_, TextBox1_, ToggleButton1_, TreeView1_, UserForm_ ' ------------------------------------------ ' --- _MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) ' ------------------------------------------ ' CheckBox1_, ComboBox1_, CommandButton1_, Frame1_, Image1_, Label1_, ListBox1_, MonthView1_, MultiPage1_ ' OptionButton1_, SBProgress1_, TabStrip1_, TextBox1_, ToggleButton1_, TreeView1_, UserForm_



Note to Webmaster