Page count in word document

Insert Page X of Y

If you have a header or footer already, click or tap where you want to put the page number first.

  1. Go to Insert > Page Number.

  2. Do one of the following:

    • Select Current Position if you have a header or footer.

    • Select a location if you have no header or footer yet.

  3. Scroll until you see Page X of Y and select a format.

  4. Select Close Header and Footer, or double-click anywhere outside the header or footer area.

  1. Double-click in the footer or header where you want page numbering.

  2. Go to Header & Footer > Footer, and then scroll to find and select Semaphore.

  3. Select Close Header and Footer or double-click anywhere outside of the header or footer areas to exit.

See also

Start page numbering later in your document

  1. Go to Insert > Page Numbers

  2. Select Include Page Count for an X of Y format.

  3. Choose a location.

To remove page numbers, repeat these steps but choose Remove Page Numbers.

I am making lots of changes to a Word document using automation, and then running a VBA macro which — among other things — checks that the document is no more than a certain number of pages.

I’m using ActiveDocument.Information(wdNumberOfPagesInDocument) to get the number of pages, but this method is returning an incorrect result. I think this is because Word has not yet updated the pagination of the document to reflect the changes that I’ve made.

ActiveDocument.ComputeStatistics(wdStatisticPages) also suffers from the same issue.

I’ve tried sticking in a call to ActiveDocument.Repaginate, but that makes no difference.

I did have some luck with adding a paragraph to the end of the document and then deleting it again — but that hack seems to no longer work (I’ve recently moved from Word 2003 to Word 2010).

Is there any way I can force Word to actually repaginate, and/or wait until the repagination is complete?

braX's user avatar

braX

11.5k5 gold badges20 silver badges33 bronze badges

asked Jun 3, 2013 at 10:03

Gary McGill's user avatar

Gary McGillGary McGill

26k25 gold badges117 silver badges200 bronze badges

17

I just spent a good 2 hours trying to solve this, and I have yet to see this answer on any forum so I thought I would share it.

https://msdn.microsoft.com/en-us/vba/word-vba/articles/pages-object-word?f=255&MSPPError=-2147217396

That gave me my solution combined with combing through the articles to find that most of the solutions people reference are not supported in the newest versions of Word. I don’t know what version it changed in, but my assumption is that 2013 and newer can use this code to count pages:

ActiveDocument.ActiveWindow.Panes(1).Pages.Count.

I believe the way this works is ActiveDocument selects the file, ActiveWindow confirms that the file to be used is in the current window (in case the file is open in multiple windows from the view tab), Panes determines that if there is multiple windows/split panes/any other nonsense you want the «first» one to be evaluated, pages.count designates the pages object to be evaluated by counting the number of items in the collection.

Anyone more knowledgeable feel free to correct me, but this is the first method that gave me the correct page count on any document I tried!

Also I apologize but I cant figure out how to format that line into a code block. If the mods want to edit my comment to do that be my guest.

Gary McGill's user avatar

Gary McGill

26k25 gold badges117 silver badges200 bronze badges

answered Jan 30, 2018 at 22:19

Kris K's user avatar

1

Try (maybe after ActiveDocument.Repaginate)

ActiveDocument.BuiltinDocumentProperties(wdPropertyPages)

It is causing my Word 2010 to spend half-second with «Counting words» status in status bar, while ActiveDocument.ComputeStatistics(wdStatisticPages) returns the result immediately.

Source: https://support.microsoft.com/en-us/kb/185509

answered Jul 15, 2015 at 8:41

alexkovelsky's user avatar

alexkovelskyalexkovelsky

3,7911 gold badge27 silver badges21 bronze badges

5

After you’ve made all your changes, you can use OnTime to force a slight delay before reading the page statistics.

Application.OnTime When:=Now + TimeValue("00:00:02"), _
        Name:="UpdateStats"

I would also update all the fields before this OnTime statement:

ActiveDocument.Range.Fields.Update

answered Jun 15, 2013 at 11:19

Andy G's user avatar

Andy GAndy G

19.1k5 gold badges49 silver badges69 bronze badges

1

I found a possible workaround below, if not a real answer to the topic question.
Yesterday, the first ComputeStatistics line below was returning the correct total of 31 pages, but today it returns only 1.

The solution is to get rid of the Content object and the correct number of pages is returned.

Dim docMultiple As Document
Set docMultiple = ActiveDocument 
lPageCount = docMultiple.Content.ComputeStatistics(wdStatisticPages)  ' Returns 1
lPageCount = docMultiple.ComputeStatistics(wdStatisticPages)  ' Returns correct count, 31

dwitvliet's user avatar

dwitvliet

7,0647 gold badges36 silver badges62 bronze badges

answered Jul 17, 2014 at 15:21

Dan McSweeney's user avatar

1

ActiveDocument.Range.Information(wdNumberOfPagesInDocument)

This works every time for me. It returns total physical pages in the word.

4b0's user avatar

4b0

21.7k30 gold badges95 silver badges140 bronze badges

answered Oct 26, 2017 at 4:11

Saurav Dubey's user avatar

1

I used this from within Excel
it worked reliably on about 20 documents
none were longer than 20 pages but some were quite complex
with images and page breaks etc.

Sub GetlastPageFromInsideExcel()
Set wD = CreateObject("Word.Application")
Set myDoc = wD.Documents.Open("C:Tempmydocument.docx")
myDoc.Characters.Last.Select        ' move to end of document
wD.Selection.Collapse               ' collapse selection at end
lastPage = wD.Selection.Information(wdActiveEndPageNumber)
mydoc.close
wd.quit
Set wD = Nothing
End Sub

answered Mar 23, 2020 at 7:36

anthony Judd's user avatar

One problem I had in getting «ComputeStatistics» to return a correct page count was that I often work in «Web Layout» view in Word. Whenever you start Word it reverts to the last view mode used. If Word was left in «Web Layout» mode «ComputeStatistics» returned a page count of «1» page for all files processed by the script. Once I specifically set «Print Layout» view I got the correct page counts.

For example:

$MSWord.activewindow.view.type = 3    # 3 is 'wdPrintView', 6 is 'wdWebView'
$Pages = $mydoc.ComputeStatistics(2)  # 2 is 'wdStatisticPages'

answered Feb 17, 2022 at 1:48

Lewis Newton's user avatar

You can use Pages-Object and its properties such as Count. It works perfect;)

Dim objPages As Pages
Set objPage = ActiveDocument.ActiveWindow.Panes(1).Pages

QuantityOfPages = ActiveDocument.ActiveWindow.Panes(1).Pages.Count

answered Sep 27, 2022 at 20:01

Sultan Khan's user avatar

1

Dim wordapp As Object
Set wordapp = CreateObject("Word.Application")
Dim doc As Object
Set doc = wordapp.Documents.Open(oFile.Path)

Dim pagesCount As Integer
pagesCount = doc.Content.Information(4) 'wdNumberOfPagesInDocument
doc.Close False
Set doc = Nothing

answered May 30, 2019 at 5:42

soko8's user avatar

soko8soko8

11 bronze badge

1

In previous posts about word-count in Microsoft Word, we reviewed standard methods of counting words, characters, and lines in Microsoft Word, but what about page count

If translators work with a lengthy document, it raises the issue of page count. To count pages manually is a bad idea, you know. So how do we deal with that?

Page count with the Microsoft Word statistics window.

You can access the word-count statistics pop-up window, where the Microsoft Word displays the number of pages. You can open it via the Review tab > Proofing > Word Count.

Count pages with the Status Bar.

On the status bar at the bottom of the Word window, you can find statistics on the number of pages, as well as the information about what page you are currently on.

If you don’t see your page statistics on the Status Bar, you should do the following: 

  • Right-click on the Status Bar
  • After the “Customize Status Bar” shortcut menu appeared, activate the “Page Number” by ticking it.
  • Page statistics should appear on the Status Bar.

Page number in Microsoft Word

In case you need navigation between pages in your document, you can open the navigation pane by clicking the page number in the lower-left corner of the screen.

Navigation pane page count Microsoft Word

AnyCount handles page count better than any other word-count tool. Just select count units:

AnyCount page count settings

Click the “Count!” button and get results:

AnyCount page count

Word includes a tool that allows you to view simple statistics about your document. These statistics include how many pages, words, characters, paragraphs, and lines are in your document. This is useful if you have to follow certain guidelines when writing your document.

To view these statistics, open the document in question and click the “Review” tab.

In the “Proofing” section, click “Word Count”.

The “Word Count” dialog box displays, as shown in the image at the beginning of this document. The number of pages and words can also be viewed on the status bar at the bottom of the Word window.

NOTE: The number of pages is only visible on the status bar when you are viewing your document in “Print Layout” view or “Draft” view (using the “View” tab).

If you don’t see the number of pages and words on the status bar, right-click on the status bar and select the items you want to view from the popup menu. Note that you can also view the line number for the line where the cursor is currently located.

The number of lines and pages may vary, depending on several factors, such as the margins in your document, the font and font size, and paragraph spacing, to name a few. For example, if you change to a smaller font size, there will be fewer lines and pages in your document than there would be with a larger font size. Even different printer drivers can result in a slightly different rendering of a font, thereby changing the number of lines and pages in your document.

Hidden text can also affect the line count reported on the “Word Count” dialog box. If the option to print hidden text is turned of, Word doesn’t count hidden text in the line count. If you want hidden text included in the line count, make sure you configure Word to print hidden text.

READ NEXT

  • › How to Get a Paragraph Count for a Specific Paragraph Style in a Word Document
  • › How to Count Characters in Word
  • › How to Get Workbook Statistics in Microsoft Excel
  • › How to Count Characters in Microsoft Excel
  • › How to Check the Word Count in Microsoft Word
  • › HoloLens Now Has Windows 11 and Incredible 3D Ink Features
  • › The New NVIDIA GeForce RTX 4070 Is Like an RTX 3080 for $599
  • › Google Chrome Is Getting Faster

How-To Geek is where you turn when you want experts to explain technology. Since we launched in 2006, our articles have been read billions of times. Want to know more?

На чтение 2 мин Опубликовано 02.10.2015

Статистика документа Word

В Word есть инструмент, который показывает простую статистику документа. Статистика содержит информацию о том, сколько страниц, слов, символов, абзацев и строк содержится в документе. Такая статистика полезна, если при создании документа необходимо ориентироваться на заданные параметры.

Чтобы увидеть статистику документа, откройте его и перейдите на вкладку Рецензирование (Review).

Статистика документа Word

В разделе Правописание (Proofing) нажмите Статистика (Word Count).

Статистика документа Word

Откроется диалоговое окно со статистикой, как показано на картинке в начале этой статьи. Кстати, количество страниц и слов в документе можно также увидеть в строке состояния в самом низу окна Word.

Замечание: Количество страниц отображается в строке состояния только в режимах Разметка страницы (Print Layout) или Черновик (Draft) – эти режимы включаются на вкладке Вид (View).

Статистика документа Word

Если Вы не видите в строке состояния количество страниц и слов в документе, кликните по ней правой кнопкой мыши и в появившемся меню укажите элементы, которые желаете видеть. Кроме этого, Вы можете включить отображение номера строки, в которой в данный момент находится курсор.

Статистика документа Word

Количество строк и страниц в документе может меняться – это зависит от нескольких факторов, таких как величина полей страницы, тип и размер шрифта, интервалы между абзацами и так далее. Например, если Вы уменьшаете размер шрифта, то число строк и страниц в документе также изменится. Разница в количестве строк и страниц может появиться даже из-за незначительных отличий в обработке шрифта разными драйверами печати.

Кроме этого, на количество строк, указанное в отчёте в диалоговом окне Статистика (Word Count), может повлиять скрытый текст. Если в параметрах Word отключена печать скрытого текста, то скрытый текст не будет учтён при подсчёте строк в документе. Если же Вы хотите, чтобы строки скрытого текста тоже были посчитаны, то печать скрытого текста в параметрах Word должна быть включена.

Оцените качество статьи. Нам важно ваше мнение:

Понравилась статья? Поделить с друзьями:
  • Page colors in word
  • Page color in word one page
  • Page break word что это
  • Page bookmark in word
  • Packing list скачать excel