J
Jeanette
Credit to Dave Lett for the code shown below, but I'd like someone to
take it further for me (code please - don't have a clue!). My
documents comprise the following:
Section 1 - text with endnote references, followed by odd page section
break
Section 2 - Cover page, followed by odd page section break
Section 3 - Introductory text, as well as the endnote text
Document gets printed double-sided, with each section starting on a
facing (odd) page. There is nothing wrong with the document, works
perfectly all the time. HOWEVER, what I need is to print a final
version without the endnotes. I have code already that makes the
endnote references into hidden text in the body of the document
(Section 1) - that's great. I can can also manually print p1s1-p5s1,
s2 (p1s1-p5s1 being the current number of pages in the document and s2
being the Cover page).
What I don't know and need desparately, is how to count the number of
pages in Section 1 (because this changes all the time) and then print
just those particular pages with s2.
I saw this code and grabbed it (thank you so much Dave!) and I'm
halfway there - this tells me the number of pages in section 1 - but p
l e a s e can someone help in supplying the code to send the result to
print instead of a message???
I've been at this all day, so all help gratefully received!!!!
Jeanette
Public Sub CountPagesInCurrentSection()
Dim oRng As Range
Dim s As String
' use the current section
Set oRng = Selection.Sections(1).Range
With oRng
.Collapse wdCollapseStart
.Fields.Add _
Range:=oRng, _
Type:=wdFieldSectionPages
.MoveEnd unit:=wdCharacter, Count:=1
End With
s = oRng.Fields(1).Result & " pages in the current section."
oRng.Fields(1).Delete
MsgBox s
take it further for me (code please - don't have a clue!). My
documents comprise the following:
Section 1 - text with endnote references, followed by odd page section
break
Section 2 - Cover page, followed by odd page section break
Section 3 - Introductory text, as well as the endnote text
Document gets printed double-sided, with each section starting on a
facing (odd) page. There is nothing wrong with the document, works
perfectly all the time. HOWEVER, what I need is to print a final
version without the endnotes. I have code already that makes the
endnote references into hidden text in the body of the document
(Section 1) - that's great. I can can also manually print p1s1-p5s1,
s2 (p1s1-p5s1 being the current number of pages in the document and s2
being the Cover page).
What I don't know and need desparately, is how to count the number of
pages in Section 1 (because this changes all the time) and then print
just those particular pages with s2.
I saw this code and grabbed it (thank you so much Dave!) and I'm
halfway there - this tells me the number of pages in section 1 - but p
l e a s e can someone help in supplying the code to send the result to
print instead of a message???
I've been at this all day, so all help gratefully received!!!!
Jeanette
Public Sub CountPagesInCurrentSection()
Dim oRng As Range
Dim s As String
' use the current section
Set oRng = Selection.Sections(1).Range
With oRng
.Collapse wdCollapseStart
.Fields.Add _
Range:=oRng, _
Type:=wdFieldSectionPages
.MoveEnd unit:=wdCharacter, Count:=1
End With
s = oRng.Fields(1).Result & " pages in the current section."
oRng.Fields(1).Delete
MsgBox s