View Single Post
 
Old 05-26-2022, 07:53 AM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by PolarPop View Post
For clarification, in my documents, 3 lines would be closely defined as 3 rows. The first is document number, the second is the document effective date, and the third is the page number (page x of y). Each line ends with a ^p.
That means you have 3 paragraphs, not merely a paragraph of 3 lines, in which case -and assuming you want to replace those 3 paragraphs - you could use:
Code:
                                Set wdRngTgt = .Range.Paragraphs.First
                                wdRngTgt.MoveEnd wdParagraph, 2
                                Set wdRngSrc = wdDocSrc.Sections.First.Headers(HdFt.Index).Range.Paragraphs.First
                                wdRngSrc.MoveEnd wdParagraph, 2
                                wdRngTgt.FormattedText = wdRngSrc.FormattedText
Quote:
Originally Posted by PolarPop View Post
What does this do?
Code:
wdRngTgt.FormattedText = wdRngSrc.FormattedText
This does essentially the same as a copy/paste that preserves the source formatting, but without using the clipboard.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote