Create a customized business program with excel VBA.array of objects.+doubts.. (multiple questions)



Goal – To create an array of objects (items) with properties such as cost_price,selling_price,name etc. These objects should read values for properties such as cost_price etc from a spreadsheet in which it is all written and updated. Once I have all the information stored in the objects,I should be able to able to use it in other sheets.By referencing it as obj1.cost_price ,obj204.selling_price (or the correct syntax?) .. What I understand


Class=template for objects


I can declare a class called blue_print and within that class declare variables(properties?) such as cost_price etc . then I can declare an array of objects as instances of class blue_print and they each will automatically have those properties of their own(obj1.cost_price etc).


I know a bit of java so im familiar with loops etc.. But don’t clearly grasp much about classes and objects beyond what I have explained.


Questions 1) An Object is an instance of a class? just making sure.


2) Heirarchy. Workbook>sheet ..


A) but where does class fit in it?


B) where do I declare/create the class?


C) where do I declare objects?


D) from where can I call/reference these objects?(where can I type obj2.cost_price to get that value?)


3) What is a module?


4) How do I link my objects to the input sheet.(sheet1.cell(A1).value ?)..or.. how do assign values to the properties of these objects..?


5) What is a method/function/constructor?how is it different from an object?


6) Maps? Xml files?


7) Anything else you think I should understand but don’t think I have.


Sincerely,thanks..you’ve essentially taught me VBA.


No comments:

Post a Comment