|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Deleting a table with vertically merged cells if it contains certain text.
I received help earlier on this forum regarding splitting a Table containing vertically merged cells. I am now needing to search each table within the active document to find a certain text string within a cell e.g. "DelTbl". If the string is located I would then like to delete the table from which the string was found. I'm having a little trouble getting my head around the merged cells so any help will be much appreciated. Thanks. |
#2
|
||||
|
||||
The F/R code I posted in your other thread (https://www.msofficeforums.com/word-...ged-cells.html) would require very little change to delete the table instead of splitting it. Indeed, it could be done with 6 fewer lines of code...
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Okay thank you, I shall persevere.
|
#4
|
||||
|
||||
Replace:
"Tree Number" with: "DelTbl" and replace: Code:
If .Information(wdWithInTable) = True Then With .Cells(1) If .RowIndex > 1 Then If Split(.Range.Text, vbCr)(0) = StrFnd Then .Range.InsertBreak (wdColumnBreak) End If End With End If Code:
If .Information(wdWithInTable) = True Then .Tables(1).Delete
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Thanks Paul, is now working correctly.
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Finding Tables with Vertically Merged Cells | T-Belle | Word VBA | 10 | 07-19-2020 07:09 PM |
Converting table to text (and back) with carriage returns in cells, split and merged cells | ndajko | Word | 5 | 11-04-2019 07:53 AM |
Format tables with vertically merged cells | jeffreybrown | Word VBA | 2 | 01-16-2019 03:23 PM |
Unmerging vertically merged cells | kilroy | Word VBA | 5 | 01-12-2018 12:54 PM |
Overcome issues in tables with vertically merged cells | rocky2 | Word VBA | 12 | 12-22-2016 03:03 AM |