RDC11023: Procedure MS-VBA refuses as too large
Severity: Warning · Family: RDC (Rubberduck Core analyzers) ·
Raised by: ProcedureTooLargeAnalyzer
A procedure has more than 5,000 statements. RD-VBA runs it, and MS-VBA would refuse it: "Compile error: Procedure too large".
MS-VBA refuses a procedure whose compiled code is larger than 64K. How many statements that is depends on the statements: 5,000 of x = x + 1 compile and
5,250 do not, 7,000 of x = 1 compile and 8,000 do not, and 60,000 lines of comments compile (recorded in Excel). It is not a number of lines. RD-VBA
compiles no such code to measure, and runs a procedure of any size, so it warns instead, past 5,000 statements, which is where MS-VBA starts to refuse
procedures of the most common statements. MS-VBAL sets no limit.
Every statement of the procedure counts, those in the blocks of others too (an If and the statements in it); a comment is none.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
| Generated code. | A Sub that fills a table with one statement per cell |
Read the values from a range or a file, or loop over them. |
| A procedure that grew. | A Select Case of hundreds of long Cases |
Move each Case's work to a procedure of its own. |
See also
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca