Smart Indenter for VBA

Introduction

Version 4.0.7 is available to download and supports all recent 32-bit and 64-bit Windows versions of Microsoft Office and Microsoft 365.

Originally released for Excel 5.0 in 1999, the Smart Indenter is a utility to tidy up VBA code by rebuilding the indentation of each line. Most developers naturally indent code within control structures, such as For...Next, If...End If, etc. Many developers also indent all the code within a procedure, to ease identification of line labels, error handling blocks etc. From that point on, there is much more variety in indenting styles, ranging from how to treat declaration lines to handling end-of-line comments.

The latest version of the Smart Indenter includes the options shown below, including the ability to automatically indent your code as you type:

As the options are changed, the example procedure is re-indented to show the effect of the option and to give an indication of how your code will look after the indenting is complete.  Many of these options have been suggested by users of previous versions of the Smart Indenter program.  If there are other options that you'd like to see included in future versions of the program, please email support@officeaddins.co.uk.

The indenting algorithm should correctly handle all possible valid VBA code, including multi-statement lines, continued lines and line numbering.  If you find any VBA code that compiles without error but is indented incorrectly, please email the code snippet.

The Smart Indenter is integrated into the Office Visual Basic Editor and is accessed through menu items added to the Edit, Code Window and Project Explorer pop-up menus, or by user-defined hot-key combinations.  The routine can rebuild the indenting for the current procedure, current module or entire project in one pass, with full Undo available (if enabled in the Options dialog).  When undoing, the routine will not modify any lines that have been changed since the indenting was performed.

Pricing

The 30-day trial version of Smart Indenter can be downloaded here.

A perpetual license can be purchased through our authorised reseller, FastSpring, for GBP £25.00 per user plus local sales taxes.
Smart Indenter and VBE Tools can be bought together at the reduced price of GBP £40.00 per user plus local sales taxes.

Discounts are available if purchasing multiple licenses:
20% off the total when buying 2 or more.
30% off the total when buying 6 or more.

Versions

Version 4.0 is a C# COM Addin for modern 32-bit and 64-bit versions of Office

VersionReleasedDescription
4.0.722 April 2024Added confirmation check before indenting entire project and fixed Undo Indenting not working
4.0.619 April 2024Fixed VBE crashing occasionally when closed
4.0.503 April 2024Fixed some indenting issues with line continutations
4.0.421 March 2024Changed the indenting of continued lines in nested functions and parameters to align to the nested function/parameter start, with a new option to limit that to the first such level of nesting. Fixed a bug with the menus not showing up correctly in some Access builds.
4.0.318 March 2024Fixed an indenting issue with lines ending ( _
4.0.217 March 2024Fixed Access crashing on exit. Fixed indenting where compilation conditions enclose function declarations.
4.0.101 March 2024Initial version of the C# addin

Version 3.5 of the Smart Indenter is available for Office 2000/2002/2003 and might work with recent 32-bit versions if you can locate and install the VB6 run-times. This version can be found on the Office Automation web site