Welcome,
How Can We Help You?

Word Macro Inserting Tab Stops

Indent lines within a paragraph.

Info

This feature is only available in the unlimited plan.

 

Tip

Lawlift offers you the possibility of aligning paragraphs as a whole in the document using the layer function and the corresponding format templates in the letterhead template. If you also want to indent lines within a paragraph, e.g. for improved clarity, this can be implemented with the help of a macro.
 

We provide you with the appropriate code:

Sub AutoOpen() 

Set myRange = ActiveDocument.Content
myRange.Find.Execute FindText:="{Tab}"

With Selection.Find
.ClearFormatting
.Text = "{Tab}"
.Replacement.ClearFormatting
.Replacement.Text = "^t"
.Execute Replace:=wdReplaceAll, Forward:=True, _ 
Wrap:=wdFindContinue

End With

End Sub
After creating and integrating the macro with the help of the code we have provided, you now have the option of aligning individual lines in your paragraph using the tab stop function in Word.
 
You will see below exactly how this works:
 

First, set the desired tab stops via the corresponding format style in the letterhead template. You also have the option of defining several tab stops. The tab stops are set by selecting the desired format style. Then, via the "Format" tab, you reach the "Tab stops" button, where you can insert user-defined tab stops via the "Plus" sign.

 

To make Word understand where you want to indent the text, place the expression "{Tab}" in Lawlift at the desired positions (IMPORTANT: To indent a complete line, the expression must be placed at the beginning of the line. Therefore it is necessary to insert a line break with the key combination SHIFT + Enter before the expression). This expression works in principle like using the TAB key on your keyboard in an ordinary Word document. You can enter the expression as often as you like in succession in order to select the desired tab stop in the case of several defined tab stops.

 
If you have designated the macro as "AutoOpen" and saved it, Word will automatically insert the tab stops when you open the document. If you have not done this, you will have to run the macro manually via the tab "Developer Tools" -> "Macros" -> "Run Macros". 
 
As a result, the tab stops entered above are displayed as follows:
 
 
 
1x {Tab} => Tab stop at 1.5
2x {Tab} => tab stop at 6
3x {Tab} => tab stop at 8
 
This corresponds to the tab stops defined above from the format template.
 

Warning

Please clarify beforehand to what extent macros may be used in your company and if so, how. A distinction is usually made between your own macros and those of third parties. If necessary, the macro must be checked and set up by an authorized person. You can also upload macro files as letterhead templates, but the Word document then generated may be classified by your system as an "external document" even though it is based on your letterhead template. The macro may then not be executable or the whole file may be blocked. There are two ways to make macros usable. Either locally on computers approved by IT or via LAWLIFT by storing the .docm file there as a BKV. In the latter case, however, your IT must allow the execution of macros (automatically) in the Word file then generated.

 

 

 

Was this article helpful?

Can't find what you're looking for?

Our award-winning customer care team is here for you.

Contact Support