-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCreateIndexesTOAs
114 lines (99 loc) · 5.23 KB
/
CreateIndexesTOAs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
Public Function pfCreateIndexesTOAs()
'============================================================================
' Name : pfCreateIndexesTOAs
' Author : Erica L Ingram
' Copyright : 2019, A Quo Co.
' Call command: Call pfCreateIndexesTOAs
' Description : creates indexes and indexes certain things
'============================================================================
'bookmarks created from another piece of code, also posted here.
sCourtDatesID = Forms![NewMainMenu]![ProcessJobSubformNMM].Form![JobNumberField]
sFileName = "T:\In Progress\" & sCourtDatesID & "\" & sCourtDatesID & "-CourtCover.docx"
With ActiveDocument
Selection.Goto What:=wdGoToBookmark, Name:="IndexA"
With ActiveDocument.bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
With ActiveDocument
.TablesOfContents.Add Range:=.Application.Selection.Range, UseHeadingStyles:=False, UseFields:=True, TableID:="a", RightAlignPageNumbers:=True, IncludePageNumbers:=True, UseHyperlinks:=True
.indexes.Add Range:=Selection.Range, HeadingSeparator:= _
wdHeadingSeparatorNone, Type:=wdIndexRunin, NumberOfColumns:= _
wdAutoPosition, IndexLanguage:=wdEnglishUS
.indexes(1).TabLeader = wdTabLeaderDots
End With
Selection.Goto What:=wdGoToBookmark, Name:="IndexB"
With ActiveDocument.bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
With ActiveDocument
.TablesOfContents.Add Range:=.Application.Selection.Range, UseHeadingStyles:=False, UseFields:=True, TableID:="b", RightAlignPageNumbers:=True, IncludePageNumbers:=True, UseHyperlinks:=True
.indexes.Add Range:=Selection.Range, HeadingSeparator:= _
wdHeadingSeparatorNone, Type:=wdIndexRunin, NumberOfColumns:= _
wdAutoPosition, IndexLanguage:=wdEnglishUS
.indexes(1).TabLeader = wdTabLeaderDots
End With
Selection.Goto What:=wdGoToBookmark, Name:="IndexC"
With ActiveDocument.bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
With ActiveDocument
.TablesOfContents.Add Range:=.Application.Selection.Range, UseHeadingStyles:=False, UseFields:=True, TableID:="c", RightAlignPageNumbers:=True, IncludePageNumbers:=True, UseHyperlinks:=True
.indexes.Add Range:=Selection.Range, HeadingSeparator:= _
wdHeadingSeparatorNone, Type:=wdIndexRunin, NumberOfColumns:= _
wdAutoPosition, IndexLanguage:=wdEnglishUS
.indexes(1).TabLeader = wdTabLeaderDots
End With
Selection.Goto What:=wdGoToBookmark, Name:="IndexD"
With ActiveDocument.bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
With ActiveDocument
.TablesOfContents.Add Range:=.Application.Selection.Range, UseHeadingStyles:=False, UseFields:=True, TableID:="d", RightAlignPageNumbers:=True, IncludePageNumbers:=True, UseHyperlinks:=True
.indexes.Add Range:=Selection.Range, HeadingSeparator:= _
wdHeadingSeparatorNone, Type:=wdIndexRunin, NumberOfColumns:= _
wdAutoPosition, IndexLanguage:=wdEnglishUS
.indexes(1).TabLeader = wdTabLeaderDots
End With
Selection.Goto What:=wdGoToBookmark, Name:="IndexE"
With ActiveDocument.bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
.TablesOfContents.Add Range:=.Application.Selection.Range, UseHeadingStyles:=False, UseFields:=True, TableID:="e", RightAlignPageNumbers:=True, IncludePageNumbers:=True, UseHyperlinks:=True
.indexes.Add Range:=Selection.Range, HeadingSeparator:= _
wdHeadingSeparatorNone, Type:=wdIndexRunin, NumberOfColumns:= _
wdAutoPosition, IndexLanguage:=wdEnglishUS
.indexes(1).TabLeader = wdTabLeaderDots
ActiveDocument.Application.Selection.Goto What:=wdGoToBookmark, Name:="TOAC" 'cases TOA section
With ActiveDocument.bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
.TablesOfAuthorities.Add Range:=.Application.Selection.Range, Category:=1, Passim _
:=False, KeepEntryFormatting:=True
.TablesOfAuthorities(1).TabLeader = wdTabLeaderDots
.TablesOfAuthorities.Format = wdIndexIndent
ActiveDocument.Application.Selection.Goto What:=wdGoToBookmark, Name:="TOAR" 'rules/regs/code TOA section
With ActiveDocument.bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
.TablesOfAuthorities.Add Range:=.Application.Selection.Range, Category:=2, Passim _
:=False, KeepEntryFormatting:=True
.TablesOfAuthorities(1).TabLeader = wdTabLeaderDots
.TablesOfAuthorities.Format = wdIndexIndent
ActiveDocument.Application.Selection.Goto What:=wdGoToBookmark, Name:="TOAO" 'other authorities TOA section
With ActiveDocument.bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
.TablesOfAuthorities.Add Range:=.Application.Selection.Range, Category:=3, Passim _
:=False, KeepEntryFormatting:=True
.TablesOfAuthorities(1).TabLeader = wdTabLeaderDots
.TablesOfAuthorities.Format = wdIndexIndent
End With
End Function