How to Get a Word Form Field's Page and Coordinates in WPS Writer
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.

- 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.
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.
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.
In WPS Writer, press Alt+F11 or go to Developer > Visual Basic to open the macro editor.
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.
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.
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.
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. Open the document: Launch WPS Writer and open the document that contains the Word form field.
- 2. Open the macro editor: Press Alt+F11 or click Developer > Visual Basic to open the VBA editor.
- 3. Reference the field Range: In the On Entry or On Exit macro, use ActiveDocument.FormFields("FieldName").Range.Information(wdActiveEndPageNumber), wdVerticalPositionRelativeToPage, and wdHorizontalPositionRelativeToPage.
- 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.

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.




