![]() |
#10
|
||||
|
||||
![]()
Try the following macro:
Code:
Sub ApplyPageNos() Application.ScreenUpdating = False Dim Rng As Range, i As Long, StrTxt As String StrTxt = "Page: " With ActiveDocument .Fields.Unlink For i = (.ComputeStatistics(wdStatisticPages) - 1) To 1 Step -1 Set Rng = .GoTo(What:=wdGoToPage, Name:=i) Set Rng = Rng.GoTo(What:=wdGoToBookmark, Name:="\page") With Rng .End = .End - 1 If .Characters.Last.Text <> Chr(13) Then .Characters.Last.InsertAfter vbCr End If .InsertAfter vbCr & StrTxt & i + 1 End With Next .Range.InsertBefore vbCr & StrTxt & "1" End With Set Rng = Nothing Application.ScreenUpdating = True End Sub In reality, probably the safest way to do what you're after would be to convert the documents, with page #s in the headers, to PDF, then extract the content from there.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
macro, page numbering |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
2 page document printing problem, text from page 1 in layout of page 2 when printed | laurawether45 | Word | 1 | 08-02-2012 07:03 AM |
![]() |
kimsi | Word | 3 | 11-15-2011 11:54 PM |
![]() |
cheech1981 | Word | 5 | 11-15-2011 04:16 AM |
Add text to page numbers | alpruett | Word | 0 | 07-07-2010 09:40 AM |
One Page With Dynamic PAge Number | 0x7C4 | Word | 0 | 08-17-2009 11:03 AM |