2 Methods to Center All Pictures and Text Boxes in Your Word Document

In this article, we would like to introduce you with 2 methods to center all pictures and text boxes in your Word document.

Pictures and shapes, such as text boxes, play vital important in making a wonderful document. With a growing number of images and shapes being inserted, the demand to integrate their formatting, say to center them starts to surface.

What you should know is that all pictures inserted into document is set in “In line with text” layout, while text boxes are flowing shapes. You may change the picture layout as required, but to center them you will have to consider the text wrapping. Because text formatting can be easily tampered, leaving you with a layout you don’t like.Text Boxes and Pictures in Different Layout

Therefore, we will focus on 2 ways to center “In line with text” pictures and text boxes.

Method 1: Center One Picture or Text Box Manually

To center a “In line with text” picture, follow these steps:

  1. Firstly, click on the picture to select it.
  2. Secondly, click “Center” in “Paragraph” group under “Home” tab. Or you can use the shortcuts “Ctrl+ E” instead.Select Picture->Click "Home"->Click "Center"

Then to center a text box, go through these instructions:

  1. Similarly, click on text box to have it in selection.
  2. Then click “Format” tab under “Drawing Tools”.
  3. Next click “Align” in “Arrange” group.
  4. And choose “Align Center” on its drop-down menu.Select Text Box->Click "Format"->Click "Align"->Choose "Align Center"

Method 2: Batch Center Multiple Pictures or Text Boxes Automatically

Most of us would favor an automatic process to save efforts. Here you go.

  1. First off, press “Alt+ F11” to open the VBA editor.
  2. Next click “Normal” project.
  3. Click “Insert” tab and choose “Module”.Click "Normal"->Click "Insert"->Click "Module"
  4. Then double click on the module to bring out the editing space on the right side.
  5. Next to center pictures, you paste the following codes there:
Sub CenterInLinePictures()
  Dim objInLineShape As InlineShape
  Dim objDoc As Document
 
  Set objDoc = ActiveDocument
 
  For Each objInLineShape In objDoc.InlineShapes
    objInLineShape.Select
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
  Next objInLineShape 
End Sub

To center all text boxes, you need the bellowing macro:

Sub CenterTextBoxes()
  Dim objDoc As Document
  Dim objTextBox As Shape
 
  Set objDoc = ActiveDocument
 
  For Each objTextBox In objDoc.Shapes
    If objTextBox.Type = msoTextBox Then
      objTextBox.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
      objTextBox.Left = wdShapeCenter
    End If
  Next objTextBox
End Sub

To center both pictures and text boxes, you will have to use this one:

Sub CenterInLinePicturesAndTextBoxes()
  Dim objInLineShape As InlineShape
  Dim objShape As Shape
  Dim objDoc As Document
 
  Set objDoc = ActiveDocument
 
  For Each objInLineShape In objDoc.InlineShapes
    objInLineShape.Select
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
  Next objInLineShape
 
  For Each objShape In objDoc.Shapes
    If objShape.Type = msoTextBox Then
      objShape.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
      objShape.Left = wdShapeCenter
    End If
  Next objShape
End Sub
  1. Lastly, click “Run” button or hit “F5”.Enter codes->Click "Run"Center All Pictures and Text Boxes

Address Document Problems

No matter how reluctant we have to admit that Word is not foolproof. Its breaking down can lead to corruption of documents while inheriting a corrupted docx can be heart-broken for us. In order to ease such anxiety, it’s advisable to get hold of a document recovering tool in advance. Then you won’t have to worry about the data loss.

Author Introduction:

Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including xlsx corruption and pdf repair software products. For more information visit www.datanumen.com

Leave a Reply

Your email address will not be published. Required fields are marked *