Home>
I'm sorry for rudimentary questions
I'm writing a program with standard modules and user forms
There are many procedures in one module, making it difficult to read (the number of procedures and subroutines has increased, making it difficult to know which one is being referenced or not used)
It was written that reading the book would make the program easier to read with the class module
When can I use a class module to make my program easier to read?
Should I use class modules for subroutines, ForNext, if, etc.
-
Answer # 1
Related articles
- i want to know how to use exit do with vba
- vba - how to use offset
- how to use innertext with vba
- vba - i want to use a class module to link checkboxes of any number of automatically generated ole objects
- python 3x - how to use python class
- vba - how to use selenium offset
- kotlin - i want to know how to use selector with bottomnav
- how to make vba "undo" function?
- python - i'm not sure how to use numpy zeros
- vba - to end the original sub with the method created in the class module
- ios - how to use tableview in xcode
- html - i don't know how to use mathml
- how to use operators in ruby
- javascript - how to use sweet alert
- how to use sql statement from php
- c++ - i'm not sure how to use it with madgwick filter in mbed
- ruby - i don't know how to use each
- unity - how to use invoke
- how to use php8 jit
- php - how to use for and while
Submodules, ForNext, if, etc. and class modules are of different dimensions, so even if you replace them with class modules, it will often be meaningless.
Class modules are not easy to read, it depends on how you write and design.
Excel and Access have various functions as standard, but they can be said to be one class. First, if you use it well, it will be simple and fast processing.
As Excel and Access itself are highly functional, I don't think there are many processes that require class modules in VBA.
Class modules may be effective when creating large, multi-functional ones, but it requires considerable skill.
First, the procedures are grouped into appropriate modules according to their roles. Divide the procedure into appropriate blocks that make the name of the procedure easy to understand and cheap. There are many ways to make it easier to read.
Also, if you are calling a subroutine, you can jump to the subroutine code by placing the cursor there and right-clicking → Define (or SHuft + F2). Right click->move to the original position (or Ctrl + Shift + F2) to return to the caller.
First of all, please take advantage of the above points to make an easy-to-read design.
I think that even if you do not have the skills that can be done, even if you move on to the class module, it will be complicated and difficult to read.
One thing that can be surely effective when using class modules is when there are many controls with similar roles and you want to share the event processing. The link below will be helpful.
Combining multiple control events into a single procedure (ExcelVBA)-Personal computer college staff
How to control Change events of Control objects in batch with ExcelVBA * Ateitexe