Hi,

you can find a good example of Using class module in Excel VBA here

http://excelpoweruser.wordpress.com/2012/08/28/assign-event-to-a-bunch-of-controls/


Regards
Rajan verma

On Tuesday, 8 January 2013 20:50:16 UTC-7, Enrique Martin wrote:
>
> Paul described wonderfully. Class Module are very Important part of VBA. 
> By using this you can create your own event or event driven procedure. This 
> comes in Advance programming.
> You can run a program by clicking a command button or by changing the 
> worksheets or there are number of events which you can use for your purpose.
>
> Lets have a simple example of a label on userform. Suppose you click on 
> the label and want to open another userform or want to clear a 
> corresponding text box or anything else. This is what which can be done by 
> class module.
>
> Remember Label is the inbuilt object so you can do above incident happened 
> without using Class module but if you create your own Object (lets say a 
> bitmap image) then the role of class module comes into play.
>
> Regards,
> Anoop
>
>
> On Tue, Jan 8, 2013 at 11:19 PM, Paul Schreiner 
> <schrein...@att.net<javascript:>
> > wrote:
>
>> 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 <arsfa...@yahoo.co.in <javascript:>>
>> *To:* excel-...@googlegroups.com <javascript:>
>> *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" <hanuman...@capgemini.com <javascript:>>
>> To: "arsfa...@yahoo.co.in <javascript:>" <arsfa...@yahoo.co.in<javascript:>
>> >
>> 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 excel-...@googlegroups.com<javascript:>
>> .
>> To unsubscribe from this group, send email to 
>> excel-macros...@googlegroups.com <javascript:>.
>> 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 excel-...@googlegroups.com<javascript:>
>> .
>> To unsubscribe from this group, send email to 
>> excel-macros...@googlegroups.com <javascript:>.
>> Visit this group at http://groups.google.com/group/excel-macros?hl=en.
>>  
>>  
>>
>
>
>
> -- 
> Regards,
> Anoop
> Sr. Developer
>  

-- 
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 excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.


Reply via email to