Powered by Invision Power Board

Recommended Sites: - VBA Express - JMT Forums - MrExcel - Ozgrid - MS Discussion Groups - John Walkenbach - Chip Pearson - Stephen Bullens Excel Page - xlDynamic (Bob Phillips) - JKP (Jan Karel Pieterse) - The Xcel Files (Ivan F Moala) - The Excel Maniacs (Gareth) - Scriptorium (Rembo) - ExcelKB (XL-Dennis) - and don't forget to register here - it's free!...
  Reply to this topicStart new topicStart Poll

03 Events list
johnske
Posted: April 09, 2006 10:33 am
Quote Post


HardCore MVP
*****

Group: Site Admin
Posts: 453
Member No.: 2
Joined: March 08, 2006



Events can be used to trigger code, this code can be as complex as you like or something simple such as this example:

CODE
Option Explicit

Private Sub Workbook_Activate()
     MsgBox "This is the workbook " & Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)
End Sub

Some commonly used events are listed below, they are to be found listed in a drop-down list in the relevant code module. When any event in the list is clicked, an empty event procedure using the correct syntax is created in the code module as shown in the image at the bottom.

Each control on (say) a userform also has its own set of events. These events are too numerous to list, but they can be found listed in a drop-down list in the relevant code module. When any event in the list is clicked, an empty event procedure using the correct syntax is created in the code module.


Workbook Events
  • Workbook_Activate
  • Workbook_AddinInstall
  • Workbook_AddinUninstall
  • Workbook_BeforeClose
  • Workbook_BeforePrint
  • Workbook_BeforeSave
  • Workbook_Deactivate
  • Workbook_NewSheet
  • Workbook_Open

Workbook Worksheet Events
(Workbook Worksheet Events are worksheet events that are to be applied to every worksheet)
  • Workbook_SheetActivate
  • Workbook_SheetBeforeDoubleClick
  • Workbook_SheetBeforeRightClick
  • Workbook_SheetCalculate
  • Workbook_SheetChange
  • Workbook_SheetDeactivate
  • Workbook_SheetFollowHyperlink
  • Workbook_SheetSelectionChange
  • Workbook_WindowActivate
  • Workbook_WindowDeactivate
  • Workbook_WindowResize

Worksheet Events
(Worksheet Events apply only to the sheet where the code resides)
  • Worksheet_Activate
  • Worksheet_BeforeDoubleClick
  • Worksheet_BeforeRightClick
  • Worksheet_Calculate
  • Worksheet_Change
  • Worksheet_Deactivate
  • Worksheet_FollowHyperlink
  • Worksheet_SelectionChange

UserForm Events
  • UserForm_Activate
  • UserForm_AddControl
  • UserForm_BeforeDragOver
  • UserForm_BeforeDropOrPaste
  • UserForm_Click
  • UserForm_DblClick
  • UserForm_Deactivate
  • UserForm_Error
  • UserForm_Initialize
  • UserForm_KeyDown
  • UserForm_KeyPress
  • UserForm_KeyUp
  • UserForm_Layout
  • UserForm_MouseDown
  • UserForm_MouseMove
  • UserForm_MouseUp
  • UserForm_QueryClose
  • UserForm_RemoveControl
  • UserForm_Resize
  • UserForm_Scroll
  • UserForm_Terminate
  • UserForm_Zoom


Attached Image
Attached Image


--------------------------------------------------------------------------------
If I irradiate my cat will that give it eighteen half-lives?

The major part of getting the right answer lies in asking the right question...
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll