![]() |
#6
|
||||
|
||||
![]()
Try this one
Code:
Sub Results2() Dim i As Integer, iTables As Integer Dim aTbl As Table, tblLast As Table, tblTgt As Table, aCellTgt As Cell Dim aRng As Range, aRngEnd As Range, aRngSource As Range iTables = ActiveDocument.Tables.Count Set tblLast = ActiveDocument.Tables(iTables) Set tblTgt = tblLast.Tables(2) Set aCellTgt = tblTgt.Cell(1, 2) aCellTgt.Range.Text = "" 'if you want to start with a blank cell For i = 1 To iTables - 1 Set aTbl = ActiveDocument.Tables(i) Set aRng = aTbl.Range.Cells(1).Range If InStr(aRng.Text, "Worksheet") > 0 Then Set aRngSource = aTbl.Range.Cells(aTbl.Range.Cells.Count).Range aRngSource.MoveEnd Unit:=wdCharacter, Count:=-1 Set aRngEnd = aCellTgt.Range aRngEnd.Collapse Direction:=wdCollapseEnd aRngEnd.MoveEnd Unit:=wdCharacter, Count:=-1 aRngEnd.FormattedText = aRngSource.FormattedText aRngEnd.InsertAfter vbCr & vbCr End If Next i End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to compile text from multiple tables into a cell in a nested table | jrooney7 | Word VBA | 2 | 03-11-2019 07:55 AM |
![]() |
BIMwit | Word Tables | 1 | 05-14-2015 09:50 PM |
Ink to Text lines are different lengths | raineysky | OneNote | 0 | 02-12-2015 11:21 AM |
![]() |
Metamag | Office | 3 | 05-09-2011 06:25 PM |
![]() |
dineshtgs | Word Tables | 1 | 04-07-2011 01:27 AM |