-
Notifications
You must be signed in to change notification settings - Fork 0
/
a2_createAbntTOC.bas
48 lines (37 loc) · 1.36 KB
/
a2_createAbntTOC.bas
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
Attribute VB_Name = "a2_createAbntTOC"
Sub createAbntTOC(control As IRibbonControl)
'Set myRange = ActiveDocument.Range(0, 0)
Set myRange = Selection.Range
stylesList = "Título não numerado,1"
For intLoop = 1 To 4
stylesList = stylesList + ", Título" & " " & intLoop & "," & intLoop
With ActiveDocument.Styles("TOC " & intLoop)
.AutomaticallyUpdate = True
.BaseStyle = "New normal"
.NextParagraphStyle = "New normal"
Select Case intLoop
Case 1
.Font.AllCaps = True
.Font.Bold = True
Case 2
.Font.AllCaps = True
.Font.Bold = False
Case 3
.Font.AllCaps = False
.Font.Bold = False
Case 4
.Font.AllCaps = False
.Font.Bold = False
.Font.Size = 11
End Select
End With
Next intLoop
ActiveDocument.TablesOfContents.Add _
Range:=myRange, _
UseFields:=False, _
UseHeadingStyles:=True, _
LowerHeadingLevel:=4, _
UpperHeadingLevel:=1, _
AddedStyles:= _
stylesList
End Sub