2Object Oriented Programming PropertyMethodEventreadwriteEach object in a Microsoft application has properties which you can view and/or change, methods which you can utilise within a procedure and associated events to which you can attach a sub-routine.CollectionObjectobject
3Object Oriented Programming read/writePropertyMethodexecuteprocedureA sub-routine can :-- exchange values with any of an object’s properties- instruct an object to carry out any of its methods- provide code to run when any of an object’s events occurEventtriggers
4Workbook Object Workbook (object) Worksheets (property) Workbook_Open (event)Close(method)You identify a collection of worksheets by using the enclosing workbook’s Worksheets property.Name(property)ActiveSheet(property)CollectionWorksheetWorksheetWorksheet
5Object Browser Window LIBRARY PROPERTIES METHODS EVENTS OBJECT CLASS Use the view menu to locate the Object Browser Window and ensure that you have the appropriate libraries selected before searching for the object of interest.
6Sub Current_Workbook() Dim wb As Workbook Simple Sub-RoutineSub Current_Workbook()Dim wb As WorkbookSet wb = Application.ActiveWorkbookDebug.Print wb.NameSet wb = Application.Workbooks(1)wb.SaveEnd SubOBJECTPROPERTYMETHODCOLLECTIONThe sub-routine uses the variable wb to manipulate the active workbook.
7References To Object Libraries Visual Basic For ApplicationsMicrosoft Excel Object LibraryOLE AutomationMicrosoft Office Object LibraryAnother Workbook
8Simple Object Hierarchy If in doubt about where the object you need lies in the hierarchy, start with the Application object and work down.
10The object model is not perfectly consistent. Always Remember …The distinction between a property and a method is not always clear-cut.The object model is not perfectly consistent.The sub-routine uses the variable wb to manipulate the active workbook.