View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Amount of code in UserForm

The limit cited in the past is 64K. (if you export the module, the
resulting file size should be less than 64K). This is a guideline and the
caution is based on experience as there is no published official source that
cites this (that I have heard of or seen referenced).

--
Regards,
Tom Ogilvy

RB Smissaert wrote in message
...
Using Excel 2003.
Recently I posted two questions. One about a problem saving an add-in
(15/12/03) and the other one about a popup commandbar needing a repaint
(17/12/03).
I have now solved both problems and I thought it might be worth to pass

this
information on the group.
I understand that there is a limit to the size of code Modules in that if
you go above it you may get unexpected problems. Can't remember now what

the
size in bytes is, but I now it roughly equates to about 2000 lines of

code.
I understand that it is not sure if the same applies to code in UserForms.

I
think Stephen Bullen commented on this.
As I had one form with more than 5000 lines of code I thought it might be
worth it to reduce this to less than 2000 lines by shifting code to

Modules.
After having done this I solved both problems as mentioned above.
So my conclusion is that it is advisable to keep any module, probably also
Class Modules, below 2000 lines of code.
Would be interested to hear any comments on this from the Excel experts.

RBS