Your code is very readable and understandable. In the spirit of 'do no harm', I think the approach should be to make the smallest amount of changes that will make the code compile.
1. Diagnose the problem usiing 'CONDITIONAL COMPILATION'. Exclude (large sections of) code using 'CONDITIONAL COMPILATION' until the code compiles without error. Before doing this I would put the entire Subroutine or Function in a SEPARATE code module.
Make sure to make a BACKUP copy of your file before starting.
Tip: You know when a section of code is EXCLUDED when using CONDITIONAL COMPILATION, because the debugger WILL NOT let you set a breakpoint in an EXCUCTABLE STATEMENT in that section of code.
2. Put excluded code in a separate Sub or function. Variables common to both procedures must be declared as either:
a. Formal parameters to the subroutine OR
b. Global variables
Make sure you use 'Option Explicit' at the top of the module to ensure that all variables are in scope. This example takes the global variable approach.
I hope this helps.
Lewis
Bookmarks