View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson[_2_] Chip Pearson[_2_] is offline
external usenet poster
 
Posts: 95
Default Combining Modules

Phil,

I would recommend that you not combine the modules. First of
all, there are limits to the size of a module: convention wisdom
holds that a module should not exceed 5000 lines of code or about
64K bytes.

Moreover, a well organized project is easier to maintain. You
should give your modules meaningful names rather leaving the
names Module1, Module2, etc. To rename a module, open it in the
VBA editor, press F4 to display the Properties box, and change
the name. Each module should contain functionally- or
conceptually-related procedures, and the module name should
reflect the contents of the module.

Also, what is the flow when I show a form?


When you show a form with code like Userform1.Show, code
execution stop at the Show method, and won't resume until the
form is hidden. Code within the form's code module will execute
in response to events, such as initializing the form, clicking a
control, etc.

If your code is executing procedures in standard code modules
randomly, you should use Rob Bovey's Code Cleaner to export all
the code to text files, purge the VBProject, and import the code
back in to the project. This can cure a variety of problems. You
can get the free Code Cleaner from the Free Utilities section at
www.appspro.com .

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Phillips" wrote in message
news:cFcxb.118974$Dw6.547218@attbi_s02...
I have about 40 modules, and it is getting hard to figure out

my code.

How can I combine them?

I have tried cutting and pasting, and then exporting and

deleteing modules,
but this leads to different errors, depending on what modules

combine.

Is there certain stuff in different modules?

I would have thought that if I put all of the declarations up

at the top,
that I could combine them all.

Also, what is the flow when I show a form? It seems to call

some
functions/subs by itself. If I try removing some of the

functions, yet I
find no referance calling them in the code, I get an error on

show


Thanks
Phil