![]() |
|
#1
|
|||
|
|||
|
I want to be able to delete the last paragraph within a table. After running several macros I am left with a table with just 3 paragraphs.
I have attached a sample BEFORE the macros are applied and a sample of what it looks like AFTER the macros are applied. I tried the following code and it does not seem to work. Code:
Sub UpdateTables()
Application.ScreenUpdating = False
Dim Tbl As Table, Rng1 As Range, Rng2 As Range
With ActiveDocument
For Each Tbl In .Tables
With Tbl
If .NestingLevel = 1 Then
Set Rng1 = .Cell(1, 1).Range
With Rng1
.End = .End - 1
If (.Text Like "#.") Or (.Text Like "##.") Or (.Text Like "###.") Then
Set Rng2 = .Rows(1).Cells(2).Range
With Rng2
.End = .End - 1
While .Paragraphs.Last.Range.Tables(1).NestingLevel = 1
.Paragraphs.Last.Range.Text = vbNullString
Wend
End With
End If
End With
End If
End With
Next
End With
Set Rng1 = Nothing: Set Rng2 = Nothing
Application.ScreenUpdating = True
End Sub
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Word thinks 1 sentence is 2 paragraphs and won't let me delete the extra paragraph symbol
|
jrasicmark | Word | 1 | 12-05-2014 01:50 AM |
| Macro Needed to bold specific lines and Macro to turn into CSV | anewteacher | Word VBA | 1 | 05-28-2014 03:59 PM |
Macro Needed to delete Unwanted paragraphs in series
|
frustrated teacher | Word VBA | 1 | 05-02-2014 03:32 PM |
| Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question | frustrated teacher | Word VBA | 6 | 05-02-2014 03:37 AM |
| Delete lots of empty space between paragraphs. | FieldTechnician | Word | 4 | 10-25-2013 01:14 PM |