Office Settings & Configuration

How to Consistently Display Word Document Margins in Inches using VBA

Anum MushtaqAnum Mushtaq Nov 3, 2026 871 views

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.

How to Consistently Display Word Document Margins in Inches with VBA
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).
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA Editor

Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.

2
Locate Your Macro

In the Project Explorer pane on the left, find and double-click the module containing your margin-checking macro.

3
Update the PageSetup Code

Navigate to your ActiveDocument.PageSetup block. Replace any instances of the PointsToInches function with a direct division by 72.

4
Apply to All Margins

Ensure you update the code for all margin sides. For example, use .TopMargin / 72, .BottomMargin / 72, .LeftMargin / 72, and .RightMargin / 72.

5
Test the Macro

Save the changes and run the updated macro across the affected documents to verify that margins now consistently display in inches.

Calculate Inches by Dividing Points by 72
Consistent Output Guaranteed: Using manual division guarantees the output is always in inches regardless of internal document formatting quirks that might otherwise confuse built-in conversion functions.
Free Microsoft Office alternative

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.

Fully compatible with Microsoft Word formats (.docx, .doc, .dotm).Intuitive UI to set page margins in inches or centimeters without writing complex macros.Free and lightweight, ensuring fast document loading and processing.Seamless migration with a familiar interface that requires zero learning curve.
microsoft office alternative - wps office

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.