Additional procedures

Instructions for use of lists–entries:

Ctrl + Enter insertion of a new line
Strg + A selection of all entries
Ctrl + Tab activates or deactivates a single list item

[On/Off] enables/disables all currently selected list entries

Deactivated entries are shown indented
and will be ignored in subsequent program flow.

Certain sequences of instructions can easily be relocated into external procedures.

In attempting to decipher the source–code by stepwise debugging, frequent branching
to other procedures considerably complicates understanding of the overall context.

Minimum number of consecutive lines

Reduces the number of additional procedures generated by only relocating sequences of instructions
that include at least the specified number of consecutive source–code lines.

If the minimum number = 1, EACH SUITABLE source–code line is relocated in an additional procedure
(even if it is only a single command).

Relocatable lines are only those in which commands do not relate to a local variable
or to the surrounding procedure.
As well, these lines must not be basic parts of an instructions–block
(e.g. If ... Then ... Else ... End If).
Statements that follow an "On Error GoTo <label>" will also not be relocated
(this applies until the next "On Error Resume Next" or "On Error Goto 0" or the end of the procedure).

A very large value will prevent the generation of any additional procedures
because there are no appropriate command sequences in that many consecutive source–code lines.

The value should be always put on 3. This will generate a sufficient number of additional
procedures to complicate the understanding of the source program
without causing problems during compilation of the VBA project.

An increase of the value is usually only required if:

– in rare cases a very large number of relocated commands is slowing down the program flow
  significantly because of the frequency of procedure calls

– the following error message appears when compiling the source–code:

  Out of memory (Error 7)

There are too many identifiers (thus also procedures).
It is therefore not possible to compile the source–code
(exceeds the 64K segment limit of the internal identifier table).

  Module is too large

The total code of the module has become too large
and will have to be split into two (or more) modules.
CrunchCode tries to avoid this problem but is unable to determine
when this point will be reached.

In these cases, select a number >3. This will reduce the number of additional procedures.

The above error messages can also occur in relation to the encryption of strings,
if too many constants and string variables have to be generated
because of the options set (such as "All").

Generating meaningless additional parameters

During the activation of this option up to 4 arbitrary parameters will be added to the created procedures.
The parameters have absolutely no function, however, they get pseudo values assigned in the procedure.
This makes the readability and understanding of the contextual meaning even more difficult.

without param. Function TforU() As Long
with parameters Function TforU(rZjQ As String, RsRY As Boolean, srpFmiGz As Long) As Long

Additional instructions which should be relocated

In addition to entire lines, individual instructions can be relocated.
This will increase the camouflage effect and leads to further complicates understanding.

Enter here line–by–line each sequence of statements that should be relocated.

It is independent of case sensitivity.

Single instructions are also relocated from procedures which already are themselves
a result of relocated instructions. This further complicates stepping through the code.


  Make sure that the structure (also whitespaces!) coincides EXACTLY
  with the real statement in the source–code!

  An instruction to be relocated must NOT

– be associated with local variables

– have relations to the procedure in which they are located (e.g. return–value of a function)
  respectively only be effective there locally

– occur after one of the following instructions:
On Error Resume Next
On Error GoTo <label>

– be a basic part of an instruction–block (e.g. If...Then...Else...End If)

– be part of a statement
  (excluded from it are instructions that are separated with ":")

– be spread over several lines

– be a function that returns a value
  (but it can contain a function call, including the transfer of the return value)

– be a conditional compilation instruction (e.g. #If...#End If)

– call an object property or method without naming the accompanying object
  (typically within a Width–instruction)

Otherwise it leads to runtime errors. CrunchCode DOES NOT CHECK FOR THESE!


allowed Application.ScreenUpdating = False
XXX = FunctionYYY(ZZZ)
lngX = lngX + 1 <–– only if lngX is a GLOBAL variable!

inadmissibly On Error Resume Next <–– "On Error..." is only effective locally
.ScreenUpdating = False <–– object property without object–specifying
lngX = lngX + 1 <–– only if lngX is a LOCAL variable
FunctionYYY(ZZZ) <–– if before stands "XXX = "
#If XYZ <–– conditional compilation instruction
If lngX > 0 Then <–– part of an instruction–block

as Standard

Selecting "OK" will save the current settings as your default for future projects.
Then they can be also reactivated with "Preset" –> "user–defined".


Optimisation of the settings or reset to defaults.
(inter alia to those values which were saved "as Standard").