Help!

Formatting the Index in a Word doc using VB

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> New Users RSS
Next:  how to anchor a graphic line to a specific spot  
Author Message
gailbaker
External


Since: Aug 08, 2007
Posts: 1



PostPosted: Wed Aug 08, 2007 9:53 am    Post subject: Formatting the Index in a Word doc using VB
Archived from groups: microsoft>public>word>newusers (more info?)

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
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> New Users All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum