Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Newbie Questions
Hi guys,
I am totally new to vba programming and wanted to know if anyone could explain the relationship between classes, objects, methods, and properties. I bought a good book on vba for excel, but am still a little confused. Can anyone clarify? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Newbie Questions
An object is an entity such as a workbook, worksheet or range (Like a
noun). In the object browser, objects will usually be refered to as a class. an object can have properties (attributes) (properties can themselves be objects) Workbook Name Worksheets Worksheet Name UsedRange parent <== also an object (workbook) Range <== also an object Range address Interior.colorIndex Font.colorIndex visually, a range has a background color and a font color. However, in the object model, the range has an interior (object) which can have a color or colorindex and the font can have a name, size, color, colorindex. The reason these are objects is because other types of objects can also have interiors and fonts. So this makes them reusable. If the property is not read only, you can assign it a value Activeworkbook.Worksheets("Sheet1"). Range("A1").Interior.ColorIndex = 3 ' Makes the cell A1 red. A method is like a verb, it performs an action ActiveWorkbook.Worksheets.Add adds a new worksheet the active workbook A class is generally used to refer to a developer defined object that will usually also have properties and methods created by the developer using a class module. However, as was stated at the start, a more general view is that class and object are interchangable. I am sure others will have useful thoughts as well. Note that none of the listings used are exhaustive, but are illustrative. -- Regards, Tom Ogilvy "Steve P" <Steve wrote in message ... Hi guys, I am totally new to vba programming and wanted to know if anyone could explain the relationship between classes, objects, methods, and properties. I bought a good book on vba for excel, but am still a little confused. Can anyone clarify? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Newbie Questions
'Class' and 'object' are sometimes used interchangeably. A way to keep
them distinct is to use 'object' to mean an instance of a class. E.g. Worksheet is a class, and Sheet1 is an object. A property is a property of an object, e.g. Cells is a property of Sheet1, Value is a property of each Cell. A method is a procedure for adding, changing, or deleting properties to an object, or adding or deleting an instance object of a class. Each class has a prescribed set of properties and methods that are used to define or alter an object in that class. Hth, Merjet |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Newbie Questions
Thank you for that Tom.
Do you ever sleep? -- Robert |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Newbie Questions
Snow Day <g
-- Regards, Tom Ogilvy "Robert" wrote in message ... Thank you for that Tom. Do you ever sleep? -- Robert |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Newbie Questions ? | New Users to Excel | |||
Newbie Questions 02 | Excel Programming | |||
Newbie add-in questions | Excel Programming | |||
newbie questions | Excel Worksheet Functions | |||
Newbie - two questions | Excel Programming |