ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Should Method Belong to the Class? (https://www.excelbanter.com/excel-programming/340647-should-method-belong-class.html)

Trip[_3_]

Should Method Belong to the Class?
 
Hello all,

I was wondering if there is a general rule as to when a method should
belong to a class as opposed to a general module (or vise-versa)? In
that we're talking about VBA within Excel everything I would develop
would be "in-process".

Any thoughts?

Thanks!

Trip


Jake Marx[_3_]

Should Method Belong to the Class?
 
Hi Trip,

Trip wrote:
I was wondering if there is a general rule as to when a method should
belong to a class as opposed to a general module (or vise-versa)? In
that we're talking about VBA within Excel everything I would develop
would be "in-process".


IMO, it's all about personal preference and ease of development/maintenance.
If you're used to OOP and would rather create classes with
methods/properties, then I'd say go for it. But you're right - everything
is "in-process" anyway, so it won't really matter performance-wise. If you
need to trap Application-level events, you'll have to use class modules.
Other than that, just about everything (besides UserForms) can be done with
standard modules.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]




All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com