There are basically two ways I can think of to achieve this, other than
poring over the code.
1) Write, buy or otherwise obtain a program which will check declarations
against the used variables and list, possibly remove, the redundant
declarations, i.e. a program to read the code (generally called
cross-reference utilities, or something similar).
2) Make sure you have Option Explicit turned on, delete all variable
definitions, and then let the compiler pick out the undeclared variables one
by one.
If you choose the second method, I wish you joy ...
Incidentally, if this is actually a major problem for you, consider changing
your style to use smaller routines, calling subroutines or functions to do
the bulk of the work. A code segment which is small enough to see more or
less all on-screen at once is easy enough to grasp in one go and check for
this sort of thing. The called procedure is a wonderful tool for reducing
the complexity of a piece of code, especially if things are well-named (which
means names which makes obvious the nature of the thing named, not short -
not necessarily long, either, just clear).
Quote:
> Hi there!
> I'd like to do this:
> Remove all the variables I have declared but have not used anywhere in VB
> app.
> But I couldn't the Method.
> Thanx any help!!