View Single Post
 
Old 10-07-2019, 02:56 PM
fly545 fly545 is offline Windows 10 Office 2016
Novice
 
Join Date: Oct 2019
Posts: 7
fly545 is on a distinguished road
Default

OK, So what you're saying is that i bookmark each table in the document with a different name, then i can call up the active document's bookmarks and select the range based on those bookmarks?

Then using your code:

Sub Temp3()
Dim i As Integer, iCount As Integer, aRng As Range, aTblRng As Range, j As Integer
iCount = InputBox("How many duplicates?", , "1")
For i = ActiveDocument.Tables.Count To 1 Step -1
Set aRng = ActiveDocument.Tables(i).Range.Paragraphs.First.Pr evious.Range
aRng.MoveEnd Unit:=wdCharacter, Count:=-1
If aRng.ParagraphFormat.OutlineLevel < wdOutlineLevel3 Then
Set aTblRng = ActiveDocument.Tables(i).Range
aTblRng.End = aTblRng.Paragraphs.Last.Next.Range.End
Set aRng = aTblRng.Duplicate
For j = iCount To 1 Step -1
aRng.Collapse wdCollapseEnd
aRng.FormattedText = aTblRng.FormattedText
Next j
End If
Next i
End Sub


I can then duplicate the bookmarked table into the paragraph after the table?

If i wanted to have multiple duplications, how would you suggest i go about that? (say i wanted 4 copies of the table instead of 1 based on an input).
Reply With Quote