Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-18-2020, 06:38 AM
gmayor's Avatar
gmayor gmayor is offline Insert a Paragraph mark before and after a table Windows 10 Insert a Paragraph mark before and after a table Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default


The code I posted works for the selected table, whether or not the table is at the start of the document. If you want it to work for all tables in the main story range then
Code:
Dim oTable As Table
Dim oRng As Range
Dim i As Integer
    For i = ActiveDocument.Tables.Count To 1 Step -1
        Set oTable = ActiveDocument.Tables(i)
        Set oRng = oTable.Range
        oRng.Collapse 1
        oRng.Select
        Selection.SplitTable
        Set oRng = oTable.Range
        oRng.Collapse 0
        oRng.InsertParagraphAfter
        DoEvents
    Next i
    Set oTable = Nothing
    Set oRng = Nothing
If you have an example of tables it doesn't work with, post the document so we can evaluate the problem.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert a Paragraph mark before and after a table Indention below paragraph mark... kikola Word VBA 13 05-26-2020 06:21 AM
Paragraph mark added on the top of every second page aptbs00 Word 6 09-14-2018 03:53 PM
Insert a Paragraph mark before and after a table Replace space with paragraph mark jeffreybrown Word VBA 8 08-22-2018 03:31 PM
Insert a Paragraph mark before and after a table can't delete paragraph mark at end of document kb Word 10 10-06-2017 02:32 PM
Insert a Paragraph mark before and after a table Final paragraph mark Caroline Word 2 02-22-2011 10:39 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:32 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft