Document Editing Problems

How to Get a Word Form Field's Page and Coordinates in WPS Writer

Jason MillerJason Miller Nov 13, 2026 869 views

Question details

The user needs to determine a Word form field's page number and horizontal and vertical position relative to the page because the FormField object does not expose location properties directly.

How to Get a Word Form Field's Page and Coordinates in WPS Writer
Product
WPS Writer (working with Microsoft Word legacy form fields)
Device & OS
not provided
Scenario
Working in a protected form or template and needing to locate a form field on a specific page for validation, documentation, or automated processing.
Observed behavior
The FormField object has no direct page or coordinate property; the location must be obtained through the field's Range object and its Information property.
Before you start

Open the Word document in WPS Writer and confirm that the Developer tab is visible. Make sure macros are enabled and the form field exists in the document before you open the VBA editor.

Solution 1Recommended

Retrieve Page and Position from the Form Field Range in a Macro

Use this method when a legacy form field is active and you need the exact page number and x/y coordinates, especially when the protected form prevents accessing shape properties.

Word form fields do not expose page position through direct location properties such as Left or Top. However, the field's Range object can return the page number and horizontal and vertical positions relative to the current page.

1
Open the VBA editor

In WPS Writer, press Alt+F11 or go to Developer > Visual Basic to open the macro editor.

2
Locate the form field macro

In the Project Explorer pane, double-click the module or document object that contains the On Entry or On Exit macro for the form field.

3
Add the Range.Information code

In the macro, reference the field by name and use its Range.Information property. For example: Dim p as Long: p = ActiveDocument.FormFields("FieldName").Range.Information(wdActiveEndPageNumber). Add the same pattern for wdVerticalPositionRelativeToPage and wdHorizontalPositionRelativeToPage.

4
Run or trigger the form field macro

Close the editor and enter or exit the form field depending on where the macro is attached. Use a message box or debug output to display the returned page, vertical, and horizontal values.

Values are returned in points: The vertical and horizontal position values are returned in points relative to the top and left edge of the page, so you can combine them to locate the field precisely.
WPS Writer macro solution

Get Word Form Field Page and Coordinates in WPS Writer

Open the Word document in WPS Writer and use the form field's Range object in the VBA editor to retrieve the active page number and position relative to the page, even when direct shape properties are unavailable in a protected form.

  1. 1. Open the document: Launch WPS Writer and open the document that contains the Word form field.
  2. 2. Open the macro editor: Press Alt+F11 or click Developer > Visual Basic to open the VBA editor.
  3. 3. Reference the field Range: In the On Entry or On Exit macro, use ActiveDocument.FormFields("FieldName").Range.Information(wdActiveEndPageNumber), wdVerticalPositionRelativeToPage, and wdHorizontalPositionRelativeToPage.
  4. 4. Run the field macro: Return to the document and enter or exit the form field to run the macro and read the returned values.
Retrieves page number and x/y coordinates without accessing locked Shape or form field properties.Works with legacy Word form fields in .doc and macro-enabled .docm documents.Maintains compatibility with Microsoft Word document formatting and VBA macro workflows.Uses the familiar WPS Writer Developer tab and Visual Basic editor at no cost.
microsoft office alternative - wps office

Frequently Asked Questions

Why can't I get a form field's position from its Left or Top property?

The FormField object does not expose Left or Top directly. Use the field's Range.Information property with wdVerticalPositionRelativeToPage and wdHorizontalPositionRelativeToPage to get coordinates instead.

Do I need to unprotect the form before running this macro?

No. An On Entry or On Exit macro can run while the form is protected. You only need to unprotect the document if you are editing the form field structure or adding the macro through the form field properties.

What page number does wdActiveEndPageNumber return?

It returns the page number where the end of the field's range is located. For a form field, this is normally the page containing the field.

Can I store this macro in a .docx file?

No. Macro-enabled automation must be stored in a .docm or legacy .doc format. A standard .docx file does not retain VBA macros.