|
||||
These pages are no longer updated and are only available for archive purposes.Click here to visit the pages with updated information. Workbook eventsEvents for the Workbook object occurs when the workbook is changed or
a sheet in the workbook is changed. Events in workbooks are activated by default, but can
be deactivated by a macro. To display the event procedures for a workbook you use the Visual
Basic editor. Select the desired project in the Project-window
and activate the object ThisWorkbook by doubleclicking it. Any event
procedures in the workbook will now be displayed in the Code-window on
the right side of the screen. You can create a new event procedure by selecting Workbook
in the Object dropdown, and then select an event in the Procedure
dropdown.
This example eventmacro will maximize Excel when a workbook is opened, the procedure must be written in the workbook module ThisWorkbook: Private Sub Workbook_Open() Application.WindowState = xlMaximized End Sub This example eventmacro will prevent the user from activation other worksheets than the first worksheet, the procedure must be written in the workbook module ThisWorkbook: Private Sub Workbook_SheetActivate(ByVal Sh As Object) Worksheets(1).Activate End Sub
Document last updated 1999-08-21 12:47:53 Printerfriendly version
|
||||
|