![]() |
#2
|
||||
|
||||
![]()
You should be using a style to apply to the caption rather than doing a local format for bold. Working code might be along the lines of the following
Code:
Sub UpdateTables2() Dim rng As Range Dim aTbl As Table Dim aRow As Row Dim x As Long Dim MyTables As Long: MyTables = ActiveDocument.Tables.Count Dim MyNote As String: MyNote = "Does this table have a table name" Dim answer As String Dim aRng As Range Application.ScreenUpdating = False For Each aTbl In ActiveDocument.Tables Set aRng = aTbl.Range aRng.MoveStart Unit:=wdParagraph, Count:=-1 aRng.Select ActiveWindow.ScrollIntoView aRng, True Set aRow = aTbl.Rows.Add(BeforeRow:=aTbl.Rows(1)) aRow.Range.Cells.Merge Set aRng = aRng.Paragraphs(1).Range aRng.MoveEnd Unit:=wdCharacter, Count:=-1 aRow.Range.Cells(1).Range.FormattedText = aRng.FormattedText aRng.Paragraphs(1).Range.Delete aRow.Borders(wdBorderTop).LineStyle = wdLineStyleNone aRow.Borders(wdBorderLeft).LineStyle = wdLineStyleNone aRow.Borders(wdBorderRight).LineStyle = wdLineStyleNone aRow.Range.Style = "Caption" Next aTbl Application.ScreenUpdating = True End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
kevinbradley57 | Word VBA | 9 | 09-21-2017 04:58 PM |
![]() |
lodi123 | Word VBA | 1 | 02-24-2017 05:32 AM |
Selecting a digit from a code | Warren99 | Excel | 2 | 05-29-2016 04:08 AM |
![]() |
dionnaro | Word Tables | 1 | 05-24-2016 04:04 PM |
Selecting/deselecting items in pivot table | mbesspiata | Excel | 0 | 07-22-2014 08:15 AM |