L
Lisa
I am trying to format text, then paginate the document from where the
cursor originally was on forward into the text. Doing it from where
the cursor originally was is the hard part. My program JustPaginate
works well for the second part; my program FormatSelection works well
for the first part.
However when I put them together in my program Paginate, I am unable
to get the Selection in JustPaginate to only refer to the location of
the cursor. So it does not work right.
The other thing is, is I want the programs to work with any number of
original "Sections", not just one (where my InsertBreak creates a
second one).
Somehow I would like to find some way to work with an Index within
Sections or within Paragraphs, so I can go from the current location
on forward or be able to create an additional section And tell where
that section is located.
Any ideas?
Lisa
Sub FormatSelection()
With Selection
.WholeStory
.Font.Name = "Times New Roman"
.Font.Size = 8
.ParagraphFormat.Space1
End With
End Sub
Sub JustPaginate()
'
' JustPaginate Macro
'
Selection.InsertBreak Type:=wdSectionBreakNextPage
Dim prange As Range
With ActiveDocument
With .Sections(2)
Set prange = .Headers(wdHeaderFooterPrimary).Range
With .Headers(wdHeaderFooterPrimary).PageNumbers
.RestartNumberingAtSection = True
.StartingNumber = InputBox("Enter the starting page
number.")
End With
End With
.Fields.Add Range:=prange, Type:=wdFieldEmpty, Text:="PAGE"
prange.Paragraphs(1).Alignment = wdAlignParagraphCenter
End With
End Sub
Sub Paginate()
'
' Paginate Macro
'
'
FormatSelection
JustPaginate
End Sub
cursor originally was on forward into the text. Doing it from where
the cursor originally was is the hard part. My program JustPaginate
works well for the second part; my program FormatSelection works well
for the first part.
However when I put them together in my program Paginate, I am unable
to get the Selection in JustPaginate to only refer to the location of
the cursor. So it does not work right.
The other thing is, is I want the programs to work with any number of
original "Sections", not just one (where my InsertBreak creates a
second one).
Somehow I would like to find some way to work with an Index within
Sections or within Paragraphs, so I can go from the current location
on forward or be able to create an additional section And tell where
that section is located.
Any ideas?
Lisa
Sub FormatSelection()
With Selection
.WholeStory
.Font.Name = "Times New Roman"
.Font.Size = 8
.ParagraphFormat.Space1
End With
End Sub
Sub JustPaginate()
'
' JustPaginate Macro
'
Selection.InsertBreak Type:=wdSectionBreakNextPage
Dim prange As Range
With ActiveDocument
With .Sections(2)
Set prange = .Headers(wdHeaderFooterPrimary).Range
With .Headers(wdHeaderFooterPrimary).PageNumbers
.RestartNumberingAtSection = True
.StartingNumber = InputBox("Enter the starting page
number.")
End With
End With
.Fields.Add Range:=prange, Type:=wdFieldEmpty, Text:="PAGE"
prange.Paragraphs(1).Alignment = wdAlignParagraphCenter
End With
End Sub
Sub Paginate()
'
' Paginate Macro
'
'
FormatSelection
JustPaginate
End Sub