G
gailbaker
I am using VB script to open a word document and populate it with
stuff from an Access Database.
I have an Index at the back of the document. Everything is working
fine except The Word "Index" shows up on one page and the index shows
up on another. If I try to move the word INDEX down the index also
moves down.
Here's my code for the Heading "Index" and for the index part. I guess
I'm wondering how to get the heading "Index" to be just aove the
actual index without the space in between.
Sub CreateIndex()
Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
Selection.Style = ActiveDocument.Styles("heading 1")
Selection.Font.Size = 14
Selection.TypeText Text:="INDEX"
Selection.Font.Size = 14
Selection.TypeParagraph
*****It's here that
the heading stops and the index begins*********
With ActiveDocument.Styles("Index 1").Font
.Name = "Times New Roman"
.Size = 11
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.ColorIndex = wdAuto
.Engrave = False
.Superscript = False
.Subscript = False
.Scaling = 100
.Kerning = 0
.Animation = wdAnimationNone
End With
Selection.Style = ActiveDocument.Styles("Index 1")
With ActiveDocument
.Indexes.Add Range:=Selection.Range, HeadingSeparator:= _
wdHeadingSeparatorNone, RightAlignPageNumbers:= _
True, NumberOfColumns:=1, AccentedLetters:=False
.Indexes(1).TabLeader = wdTabLeaderDots
End With
End Sub
stuff from an Access Database.
I have an Index at the back of the document. Everything is working
fine except The Word "Index" shows up on one page and the index shows
up on another. If I try to move the word INDEX down the index also
moves down.
Here's my code for the Heading "Index" and for the index part. I guess
I'm wondering how to get the heading "Index" to be just aove the
actual index without the space in between.
Sub CreateIndex()
Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
Selection.Style = ActiveDocument.Styles("heading 1")
Selection.Font.Size = 14
Selection.TypeText Text:="INDEX"
Selection.Font.Size = 14
Selection.TypeParagraph
*****It's here that
the heading stops and the index begins*********
With ActiveDocument.Styles("Index 1").Font
.Name = "Times New Roman"
.Size = 11
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.ColorIndex = wdAuto
.Engrave = False
.Superscript = False
.Subscript = False
.Scaling = 100
.Kerning = 0
.Animation = wdAnimationNone
End With
Selection.Style = ActiveDocument.Styles("Index 1")
With ActiveDocument
.Indexes.Add Range:=Selection.Range, HeadingSeparator:= _
wdHeadingSeparatorNone, RightAlignPageNumbers:= _
True, NumberOfColumns:=1, AccentedLetters:=False
.Indexes(1).TabLeader = wdTabLeaderDots
End With
End Sub