Microsoft Word Table Of Authorities VBA (Visual Basic for Applications)

Microsoft Word Table Of Authorities VBA (Visual Basic for Applications)

TablesOfAuthorities

Mostly legal documents are meant to have references which called Table of authorities. In Table of authorities following components can be presented:

  1. Citations
  2. Cases
  3. Statutes
  4. Other authorities
  5. Rules
  6. Treatises
  7. Regulations
  8. Constitutional Provisions
  9. Page Numbers
  10. Tab Leaders

Insert Table of Authorities

  1. Make selection in the document where you wish to have Table of Authorities
  2. Select Reference Tab
  3. Select Insert Table of Authorities group
  4. A dialog pops up
  5. Make necessary selection under Category
  6. Add Citations if required
  7. Choose a template if needed
  8. Say OK

Code example

Public Sub AddTableOfAuth()
    'Declare range object
    Dim oRange As Range
    Set oRange = Selection.Range
    
    'Declare document object
    Dim oDocument As Document
    Set oDocument = ActiveDocument
        
    'Create TOA
    Dim oToA As TableOfAuthorities
    Set oToA = oDocument.TablesOfAuthorities.Add(Range:=oRange, Category:=0, Passim:=True, KeepEntryFormatting:=True, EntrySeparator:=", ")
    
    'Set tableader
    oToA.TabLeader = wdTabLeaderMiddleDot
    
    'Memory cleanup
    Set oRange = Nothing
    Set oToA = Nothing
    Set oDocument = Nothing
End Sub

If you find blog useful and informative please do subscribe to get more upcoming posts.

Leave a Reply

Your email address will not be published. Required fields are marked *