Microsoft Office Tutorials and References
In Depth Information
Transferring a Selection to a New Document
It was difficult to decide exactly what to include in this tool because there are
varying requirements as to what kinds of setup formatting should be retained
or discarded. Comment out any of the property assignments under With
docNew.Sections(1).PageSetup that should not transfer to the new document.
If the original document has page numbers, consider whether it is better to
retain the original page number or to let the new document begin counting at 1.
To do the latter, comment out these four lines in the procedure:
With docNew.Sections(1).Headers _ (wdHeaderFooterPrimary)¶
.PageNumbers.RestartNumberingAtSection = True¶
.PageNumbers.StartingNumber = pgNr¶
End With¶
If DifferentFirstPage is activated for headers and footers, decide whether the
new document should reflect this or if it should begin with the header and
footer used on the page on which the selection begins. To not suppress
DifferentFirstPage when the original selection does not begin on a first page,
comment out these lines, EXCEPT for the second and third lines.
If pgNr = 1 Then¶
ProcessHeadersFooters wdHeaderFooterFirstPage, _¶
rngSel.Sections(1), docNew.Sections(1)¶
docNew.Sections(1).PageSetup. _¶
DifferentFirstPageHeaderFooter = False¶
End If¶
Select some text, and then run the macro.
Search JabSto ::

Custom Search