S
SoftwareTester
Using VBA I want to write a Word document.
My headings should NOT have numbering and a TOC will be created (at the top
of the document) after all textual data have been added.
a) I suppose I have to create new styles based on "Heading 1" .... "Heading
5" (using VBA). Is this correct? If so, how can I set numbering off (using
VBA)?
I created:
Function CreateStyleHeadingTask(NameStyle As String) As Word.Style
Set CreateStyleHeadingTask = Nothing
If Not wdDoc Is Nothing Then
With wdDoc
Set CreateStyleHeadingTask = .Styles.Add(Name:=NameStyle,
Type:=wdStyleTypeParagraph)
With CreateStyleHeadingTask
.AutomaticallyUpdate = False
.BaseStyle = "Heading 1"
.NextParagraphStyle = "normal"
With .Font
.Size = 14
.Bold = True
.Color = wdColorRed
End With
End With
End With
End If
End Function
b) How can I insert a TOC (what code) at the top of my document?
My headings should NOT have numbering and a TOC will be created (at the top
of the document) after all textual data have been added.
a) I suppose I have to create new styles based on "Heading 1" .... "Heading
5" (using VBA). Is this correct? If so, how can I set numbering off (using
VBA)?
I created:
Function CreateStyleHeadingTask(NameStyle As String) As Word.Style
Set CreateStyleHeadingTask = Nothing
If Not wdDoc Is Nothing Then
With wdDoc
Set CreateStyleHeadingTask = .Styles.Add(Name:=NameStyle,
Type:=wdStyleTypeParagraph)
With CreateStyleHeadingTask
.AutomaticallyUpdate = False
.BaseStyle = "Heading 1"
.NextParagraphStyle = "normal"
With .Font
.Size = 14
.Bold = True
.Color = wdColorRed
End With
End With
End With
End If
End Function
b) How can I insert a TOC (what code) at the top of my document?