-
November 20th, 2010, 12:03 AM
#1
Reading Object Hierarchy in a Object Model
Hello Folks,
I am quite new to the world of Object Oriented Programming. But, it does not mean that I am completely novice. I understand all the concepts of OOPLs. I work with VB, VBScript, JavaScript and Visual C++. I am trying to Automate an application using its Object Model provided by the developer. I am also trying to understand objects in,Word, Excel and other common Windows applications. I have a good programming skills, but when it comes to using existing objects or library, I do not understand the objects hierarchical concept. I know objects have parent-child relationships and some of them are inherited from another objects. And, what I understood from programming books that, an object contain methods and properties. But, when I use Excel Object model for retrieving values, the line of codes looks like this in VBscript;
Set oExcelApp = CreateObject("Excel.Application")
Set oWorkbook = oExcelApp.Workbooks.Open("G:\Documents and Settings\Arjun\My Documents\VBScripts\Practices\Excel Data\usernames.xlsx")
Set mySheet = oWorkbook.Sheets.Item("Sheet1")
As you see in the above code, I instantiated Excel Application Object and then Started using new object for opening an new spreadsheet, and new sheet.
oExcelApp is an Object reference as I created. Workbooks is a property of oExcelApp object and Open() is a method of oExcelApp.
Here is the part that I don't understand. How come a property will have a method, which is Open() in this case. Is workbook an Object? can object contain another object? Can Workbook be an object as well as property. I am totally confused.
My understanding based on what I read, if Excel Application is an object, then it has all the objects, new, open, close, save, edit, tools, options, just like what I see in GUI. And then each of these items will have methods and properties. I am not sure if I am thinking in right direction. but I need very good understanding of how these objects are organized and how I can refer them to use them in my programming.
Please help me if you know how to understand these objects.
Thank you.
Arjun
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|