Here is a somewhat vague description/analogy.
It's not ENTIRELY accurate, but I think will get the idea across.

First, let's look at an "Object".
Objects can have properties and mothods associated with them.
Let's take, for example, the Range object.

A Range object can have a Value,
but it can also have Borders, Interior Color, Font, Formula, Hidden property, a 
Name, and many more "properties"

you can also DO stuff with a Range object.

Range("A1").Copy will "copy" the range to the Windows Clipboard.
this isn't the same as copying the VALUE of a cell to the clipboard, because it 
also copies the border, colors, fonts, etc as well.
So when you PASTE the clipboard contents, it carries with it all of the 
Properties that were copied from the original Range Object.

So, let's say you wanted to create your own special Range object that looks 
just 
like the standard Range Object.

The "Range" object is actually unique.. because technically, "Range" is 
designed 
as a "Class" of objects
So you can use
Dim MyRange as Range
So, MyRange takes on all of the Attributes (Properties) and Methods as the 
Range 
Class.

You could then use:
Set MyRange = Range("A1:Z500")
To Create an object called MyRange.

Now, what if the Range Object just didn't have all of the things you look for 
in 
an Object?
(I have no idea what that could be.  The Range object is pretty comprehensive)

But let's say you wanted to create an object that did different things 
(Methods) 
depending on how you acted on it.

Say, if you clicked it, it did one thing, but if you Double-Clicked it, it did 
something else, and if you right-clicked it, it did yet something else.

Then you could create a "type" or "Class" of object that behaved the way you 
wanted it.

Chip Pearson (Pearson Software Consulting, LLC) has done a nice job describing 
Classes:

http://www.cpearson.com/excel/classes.aspx


As far as:  an "example where classes are useful than normal programming" ??

I do not believe Classes ARE "normal" programming.
I would consider them "Advanced" programming.
 
 
Paul
-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-----------------------------------------




________________________________
From: Arsfan2005 <[email protected]>
To: [email protected]
Sent: Tue, January 8, 2013 11:49:51 AM
Subject: $$Excel-Macros$$ Fw: significance of using classes in VBA




Sent from Samsung Mobile 


-------- Original message --------
Subject: significance of using classes in VBA
From: "Shinde, Hanumant" <[email protected]>
To: "[email protected]" <[email protected]>
CC: 



Hi friends,
 
I am going through Classes in VBA. I am not sure why we should uses classes. I 
don’t understand the significance of using classes.
I have never seen classes being used in my office tools.
 
Can somebody please suggest links or ebooks where I can get in depth knowledge 
of this whole concept.
Also, can somebody please show me example where classes are useful than normal 
programming,
 
Any input/feedback/suggestions are appreciated-- 
Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
 
NOTE : Don't ever post confidential data in a workbook. Forum owners and 
members 
are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/excel-macros?hl=en.

-- 
Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/excel-macros?hl=en.


Reply via email to