Quickly fix common code issues across a procedure, module, or project.
From the Inspection Results toolwindow, select an inspection result; the Fix dropdown menu lists all available quick-fixes for the selected result. Alternatively, simply right-click the result you want to apply a quick-fix to, and select the appropriate fix from the context menu.
Keep in mind that while static code analysis can easily and reliably spot syntactical elements (e.g. access modifiers, implicit keywords, etc.), analysis of code semantics is only as accurate as the internal representation of the code, and while 100% accuracy is the goal, in many cases it’s simply impossible: late-bound member calls (implicit or not) cannot be resolved, for example procedures invoked outside the VBA project (e.g. Excel user-defined functions, macros invoked by Access reports, etc.) are going to be reported as not used. Never blindly apply a quick-fix across an entire scope, module, or project, without first reviewing every individual result for a given inspection.
Exactly what a particular quick-fix does is entirely up to its implementation, but running any quick-fix will trigger an automatic reparse.
This tab lists all items found in the .xml documentation assets from the latest pre-release build. To modify this content, a pull request must be merged into the [next] branch.
Removes 'Option Base 0' statement from a module, making it implicit (0 being the default implicit lower bound for implicitly-sized arrays).
Removes 'Step 1' specifier from 'For...Next' loop statement, 1 being the implicit default 'Step' increment.
Removes 'Stop' instruction.
Removes type hint characters from identifier declarations and value literals.
Removes the declaration for a variable that is never assigned. This operation may result in broken code if the unassigned variable is in use.
Removes an instruction that references a variable that isn't assigned. This operation may break the code.
Removes the declaration for a constant, variable, procedure, or line label that isn't used. This operation can break the code if the declaration is actually in use but Rubberduck couldn't find where.
Refactors a procedure's signature to remove a parameter that isn't used. Also updates usages.
Prompts for a new name, renames a declaration accordingly, and updates all usages.
Replaces empty string literals '""' with the 'vbNullString' constant.
Replaces 'Global' access modifier with the equivalent 'Public' keyword.
Simplifies conditional Boolean literal assignments with a direct assignment to the conditional expression.
Replaces the obsolete 'Error' statement with an 'ErrObject.Raise' member call.
Replaces an explicit qualifier with 'Me'.
Replaces 'While...Wend' loop statement with equivalent 'Do While...Loop'.
Introduces an error-handling subroutine to ensure error state is properly handled on scope exit.
Declares an explicit Variant return type for a procedure that implicitly returns a Variant.
Introduces an explicit 'ByRef' modifier for a parameter that is implicitly passed by reference.
Introduces an explicit 'Public' access modifier for a procedure that is implicitly public.