How to Consistently Display Word Document Margins in Inches using VBA
Question details
The user needs a reliable VBA method to retrieve and display Word page margins in inches, as the built-in PointsToInches function sometimes returns incorrect values.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- Running a VBA macro across multiple documents to check and display their current page margin configurations.
- Observed behavior
- The macro inconsistently displays margin values; on certain documents, it outputs points (e.g., 72) instead of converting them to inches (e.g., 1).
Ensure that you have enabled Developer tools and have access to the VBA editor in your word processor before modifying macro codes. Back up the affected documents before testing new scripts.
Calculate Inches by Dividing Points by 72
Bypass the inconsistent PointsToInches function by manually dividing the margin point values by 72 to get exact inches.
In digital typography, one inch is exactly equal to 72 points. Because the built-in PointsToInches function can sometimes fail due to document corruption or compatibility issues, performing the math directly within your VBA code is a much more reliable approach.
Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.
In the Project Explorer pane on the left, find and double-click the module containing your margin-checking macro.
Navigate to your ActiveDocument.PageSetup block. Replace any instances of the PointsToInches function with a direct division by 72.
Ensure you update the code for all margin sides. For example, use .TopMargin / 72, .BottomMargin / 72, .LeftMargin / 72, and .RightMargin / 72.
Save the changes and run the updated macro across the affected documents to verify that margins now consistently display in inches.

Try WPS Office for Seamless Document Management
If you are dealing with inconsistent VBA behaviors or formatting quirks in Microsoft Word, WPS Office provides a lightweight, highly compatible, and user-friendly alternative. Enjoy familiar document formatting tools and full compatibility with Microsoft Office file formats.

Frequently Asked Questions
Why does PointsToInches sometimes return points instead of inches?
In some documents, underlying XML corruption, complex regional settings, or older compatibility modes can cause the PointsToInches function to fail silently, returning the original point value instead of converting it.
How many points are in an inch?
In digital typography and modern word processing software, exactly 72 points equal one physical inch.
Can I change the default measurement unit to inches without using VBA?
Yes. In most word processors, you can go to File > Options > Advanced. Scroll down to the Display section and change the 'Show measurements in units of' dropdown to Inches.




