Indent Lines

Top  Previous  Next

 VB6   VBA 

The Indent Lines feature allows you to indent lines of code to increase the readability. The feature uses the Tab Width that you have established in the Options window of VB/VBA, Editor tab. You can customize other settings in the Team Options window, Line Indenting section. Furthermore, you can review which methods are not correctly indented with the Line Indenting Review of the Review Quality feature.

For example, the following code is not indented:

 

Private Sub Foo()

 

Dim i As Integer
 
For i = 1 to 3
Call MsgBox(i)
Next

 

End Sub

After indenting it (with Tab Width = 4), it would become as follows:

 

Private Sub Foo()

 

   Dim i As Integer

 

   For i = 1 to 3
       Call MsgBox(i)
   Next

 

End Sub

 

MZ-Tools offers the following ways to indent lines:

  • The MZ-Tools | Other Utilities | Indent Lines... menu.
  • The Indent Lines button on the MZ-Tools - Other Utilities toolbar.
  • The keyboard shortcut associated with the Indent Lines feature.
  • The Indent Lines... menu entry on the context menu of a project or file in the Project Explorer and the context menu of the code window.

When you invoke this feature:

  • If the cursor is inside a method, the feature is executed only for that method without further action.
  • Otherwise, a window is shown that allows you to select the scope of the operation (the most suitable is preselected) and to decide whether or not to keep open the modified documents:

IndentLines

See Also:

Line Indenting Options

Keyboard Shortcuts Options