Jump to content

How to: Add Page Numbers to Word for User Tools.


Fabian

Recommended Posts

Hello 

 

The problem is, that the Page Numbers from the footer from the Word .docx files are not implanted in the file itself. Only the Page-breaks and the total amount of pages.

 

So we need a Makro for doing this.

 

Go to http://www.msofficeforums.com/word-vba/15309-macro-add-text-page-number-top-each.html

and copy the 

 

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

 

open Word and open the preferences. Here tick on the "Development tools" and open in Word a new Makro. And create one with the Makro above. Maybe you have to see the help files.

 

Test it with a file. If its work. Then I think there is some additional steps.

 

Open in Word the extended "Search and Replace" and tick here the "Regular expression" or "Regex" or "Pattern Search". Put 

 

"^13page: ([0-9]@)^13" 

 

 without quotation marks) in the  search field and replace it with

 

" [page: \1]"

(also without quotation marks)

 

If the replace field is active then go to the Format and on the first settings, you can choose "color". Take here the green which Accordance use for Pages.

 

Run the "all replace".

 

Then run a new search and replace. Without the "Pattern search" is tick. 

 

"  [page:"

 

and replace

 

"^p[page:

 

this also without the quotation marks but even with the color green in the Format section. 

 

On the end. Go to the beginning of the file and maybe you want to delete the [page: 1].

 

Save it as .html and install it in Accordance.

 

 

How you can see in the link above they also preferred to save the document als pdf and then copy-paste from there. Then you have absolut the correct page number, but you have to edit the file.

 

 

Maybe one tech guy here have a better solution. 

 

Unfortunately Accordance doesn't support the color if you import it as html. 

 

Unfortunately Accordance doesn't support the green [page: ...] as new search option in the User Tools.

 

 

 

Greetings

 

Fabian

 

 

 

 

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...