Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-16-2020, 04:50 PM
John 4 John 4 is offline Insert a Paragraph mark before and after a table Windows 10 Insert a Paragraph mark before and after a table Office 2013
Advanced Beginner
Insert a Paragraph mark before and after a table
 
Join Date: Oct 2019
Posts: 68
John 4 is on a distinguished road
Default Insert a Paragraph mark before and after a table

Word often (always?) leaves no space above and below tables. I'd like to add a paragraph before and after the table. I could have simply selected the table, then collapsed the selection to before or after the table and added paras that way, but if there's no text between the tables Word butts them tight against each other so that that method doesn't work in those cases.



I thought I had it figured out by cutting the table, inserting the paras, and then pasting the table back in again. However Word appears to treat the pasted table as a new table and performs the operation on that table again (to infinity probably).

Is there a way to get the loop to move on to the next table? Perhaps assigning a value to each table (which will be recognised after pasting it back in again). I've tried this but it takes me an age (and countless error messages) to get anything done.

Thanks for your help.

Code:
Sub AddParaB4andAfterTables()
Dim oTable As Table
For Each oTable In ActiveDocument.Tables
  oTable.Select
  Selection.Cut
  Selection.InsertParagraphBefore
  Selection.InsertParagraphBefore
  Selection.Collapse Direction:=wdCollapseStart
  Selection.Move Unit:=wdCharacter, Count:=1
  Selection.Paste
Next
End Sub
Reply With Quote
 



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
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 07:45 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