Formatting Issues

How to Fix Word Margins and Image Positioning After Running a Macro

Nimra MalikNimra Malik Oct 21, 2026 869 views

Question details

The user needs to fix paragraph indents, page margins, and incorrect image positioning after executing a Word macro.

How to Fix Word Margins and Image Positioning After a Macro Runs
Product
Word
Device & OS
not provided
Scenario
Running a macro affects text fitting within margins and causes floating images to position incorrectly.
Observed behavior
Text exceeds page margins, and images move in the opposite direction of the selected alignment command (e.g., choosing 'Position Up' aligns the image to the bottom).
Before you start

Before troubleshooting formatting issues, create a duplicate copy of your document to preserve your original layout and macro settings while testing solutions.

Solution 1Recommended

Remove Incorrect Paragraph Indents

Clear unwanted paragraph indents that push inline images and text outside the standard page margins.

Macros often apply hard-coded indent values to text blocks. Removing these manual indents allows the text and inline images to naturally wrap within the document's established margins.

1
Select content

Highlight the affected text and inline images in your document, or press 'Ctrl + A' to select the entire document.

2
Open Paragraph settings

Navigate to the 'Home' tab and click the small dialog box launcher arrow in the bottom-right corner of the 'Paragraph' group.

3
Reset indents

Under the 'Indents and Spacing' tab, set both the 'Left' and 'Right' indentation values to 0.

4
Apply changes

Click 'OK' to enforce the changes and verify that the text now fits properly inside the page margins.

Remove Incorrect Paragraph Indents
Quick Formatting Tip: You can also quickly remove all manual paragraph formatting by selecting the text and pressing 'Ctrl + Q'.
Advanced Word Processing

Easily Manage Margins and Macros in WPS Writer

WPS Writer provides intuitive page layout tools and robust macro support, allowing you to control margins, adjust image wrapping, and run VBA scripts safely without unintended formatting errors.

  1. 1. Open your document: Launch WPS Writer and open the document experiencing formatting issues.
  2. 2. Set page margins: Navigate to the 'Page Layout' tab to easily adjust margins and manage section breaks.
  3. 3. Adjust image wrapping: Select any image and use the quick-access Layout Options button that appears next to it to define wrapping and anchor behavior.
  4. 4. Manage macros securely: Access the 'Developer' tab to safely review, edit, and run your VBA macro scripts with full compatibility.
Seamlessly compatible with Microsoft Word (.docx) formats and VBA macrosVisual layout options make adjusting image anchors and wrapping simpleClear section and page setup dialogs prevent margin confusionFree and lightweight alternative for daily document processing
microsoft office alternative - wps office

Frequently Asked Questions

Why do my images align to the bottom when I select 'Position Up'?

This reversed behavior often occurs when an image's vertical position is anchored relative to an inverted or negatively offset paragraph, or if a macro has corrupted the relative position settings. Resetting the image vertical position relative to the 'Page' or 'Margin' instead of the 'Paragraph' resolves this.

Do margins apply to the whole page or just a section?

In document formatting, margins are strictly section properties rather than document-wide properties. If your document contains multiple sections, changing the margins in one specific section will not affect the layout of the others unless you specifically apply the changes to the 'Whole document'.

Can a macro permanently prevent manual position changes to images?

A macro itself doesn't actively block manual changes after it has finished executing. However, if the macro locked the image anchor or changed the image to an 'Inline with text' wrapping style, it restricts manual dragging until you change the wrapping style to floating and unlock the anchor.