View Single Post
 
Old 03-04-2021, 02:03 AM
SamDsouza SamDsouza is offline Windows 10 Office 2013
Advanced Beginner
 
Join Date: Aug 2019
Posts: 71
SamDsouza is on a distinguished road
Default Return Page Number of Paragraph Number

Hello
Any ideas if i want to know the Page No of which Para Number Exists. I am unable to find any thread of the same. Niether i am unable to fine syntax it.
Because
Determining the Current Page Number (Microsoft Word)
mentions as below
Quote:
As you are programming your macros, you may have a need to know the current page number on which the insertion point is located. This is easily obtained by using either of the following code lines in your macro:

CurPage = Selection.Information(wdActiveEndAdjustedPageNumbe r)
CurPage = Selection.Information(wdActiveEndPageNumber)

This code sets CurPage to the current page number. If you use the form containing wdActiveEndAdjustedPageNumber, then CurPage is a logical page number, not a physical page number. The difference is that logical page numbers take into account manual adjustments that may have been made to the document. For instance, if the user instructed Word to start counting pages at some value other than 1.
So instead of Selection.Information
By Using .Paragraphs(txtParaNo.Text) I want to get its Page Number.

Code:
dim i as integer

With ActiveDocument
For i = 1 to .Range.Paragraphs.Count
    With .Paragraphs(i)

    End with   
Next
End with
SamD
Reply With Quote