Skip to main content

How to move table captions from above to below or vice versa in Word document?

In a Word document, if there are multiple tables that have inserted captions below each table. But, sometimes, you may want to move these captions from below to above of the tables. How could you batch deal with this job as quickly as you can?

Move table captions from below to above or vice versa in Word with VBA code


Move table captions from below to above or vice versa in Word with VBA code

To move all table captions from below to above of the tables, the following VBA code do you a favor, please do as this:

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following macro in the Module Window.

Move table captions from below to above in a Word document

Sub ReLabelDownToUpTables()
    Dim I As Long
    Dim xRngPre As Range
    Dim xRngNext As Range
    Application.ScreenUpdating = False
    With ActiveDocument
        For I = .Tables.Count To 1 Step -1
            With .Tables(I).Range
                Set xRngPre = .Characters.First.Previous.Characters.Last
                xRngPre.Select
                Set xRngNext = .Characters.Last.Next.Paragraphs.First.Range
                xRngNext.Select
                With xRngPre
                    .InsertBefore vbCr
                    .Style = xRngNext.Style
                    .Start = .End - 1
                    .End = .Start
                End With
                If Len(xRngNext.Text) > 1 Then
                    xRngNext.End = xRngNext.End - 1
                    xRngNext.Cut
                    xRngNext.Delete
                    xRngPre.Paste
                Else
                    xRngNext.Delete
                End If
            End With
        Next
    End With
    Application.ScreenUpdating = True
End Sub

3. Then, press F5 key to run this code, and all table captions have been moved from below to above of the tables, see screenshot:

doc move table caption 1

Note: To move the table captions from above to below of each table, please apply the following VBA code:

Move table captions from above to below in a Word document

Sub ReLabelUpToDownTables()
    Dim I As Long
    Dim xRngPre As Range
    Dim xRngNext As Range
    Application.ScreenUpdating = False
    With ActiveDocument
        For I = .Tables.Count To 1 Step -1
            With .Tables(I).Range
                Set xRngNext = .Characters.First.Previous.Paragraphs.First.Range
                xRngNext.Select
                Set xRngPre = .Characters.Last.Next
                xRngPre.End = xRngPre.End - 1
                xRngPre.Select
                With xRngPre
                    .InsertBefore vbCr
                    .Style = xRngNext.Style
                    .Start = .End - 1
                    .End = .Start
                End With
                If Len(xRngNext.Text) > 1 Then
                    xRngNext.End = xRngNext.End - 1
                    xRngNext.Cut
                    xRngNext.Delete
                    xRngPre.Paste
                Else
                    xRngNext.Delete
                End If
            End With
        Next
    End With
    Application.ScreenUpdating = True
End Sub

Insert multiple table, picture or equation captions into Word document at once :

Normally, you should inser the table, picture or equation caption for the table, image or equation one by one in Word file. But, if you have Kutols for Word's Multiple Captions feature, you can insert the table, image or equation captions for all tables, images or equations as quickly as possible.

doc move table caption 2

Kutools for Word: with more than 100 handy Word add-ins, free to try with no limitation in 60 days. Click to Download and free trial Now!

Best Office Productivity Tools

Kutools for Word - Elevate Your Word Experience with Over 100 Remarkable Features!

🤖 Kutools AI Assistant: Transform your writing with AI - Generate Content  /  Rewrite Text  /  Summarize Documents  /  Inquire for Information based on Document, all within Word

📘 Document Mastery: Split Pages  /  Merge Documents  /  Export Selection in Various Formats (PDF/TXT/DOC/HTML...)  /  Batch Convert to PDF  /  Export Pages as Images  /  Print Multiple Files at once...

Contents Editing: Batch Find and Replace across Multiple Files  /  Resize All Pictures  /  Transpose Table Rows and Columns  /  Convert Table to Text...

🧹 Effortless Clean: Sweap away Extra Spaces  /  Section Breaks  /  All Headers  /  Text Boxes  /  Hyperlinks  /  For more removing tools, head to our Remove Group...

Creative Inserts: Insert Thousand Separators  /  Check Boxes  /  Radio Buttons  /  QR Code  /  Barcode  /  Diagonal Line Table  /  Equation Caption  /  Image Caption  /  Table Caption  /  Multiple Pictures  /  Discover more in the Insert Group...

🔍 Precision Selections: Pinpoint specific pages  /  tables  /  shapes  /  heading paragraphs  /  Enhance navigation with more Select features...

Star Enhancements: Navigate swiftly to any location  /  auto-insert repetitive text  /  seamlessly toggle between document windows  /  11 Conversion Tools...

👉 Want to try these features? Kutools for Word offers a 60-day free trial, with no limitations! 🚀
Free Download     Read More     Buy Now
 
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations