![]() |
#1
|
|||
|
|||
![]()
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 |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
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 |
![]() |
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 |
![]() |
Caroline | Word | 2 | 02-22-2011 10:39 AM |