![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#4
|
||||
|
||||
|
The logic to add more than one row is essentially the same - you just need to extend the range being replicated to include those additional rows. ISTR posting code here some time ago to do something like that.
The code to replicate a table might be as simple as: Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
With CCtrl
Call TableDuplicate(.Range.Tables(1).Range)
End With
End Sub
Sub TableDuplicate(RngSrc As Range)
Dim RngTgt As Range
With ActiveDocument
On Error Resume Next
With RngSrc
With .Tables(1).Range.Duplicate
.Collapse wdCollapseEnd
.InsertAfter vbCr & vbCr
Set RngTgt = .Characters.Last
End With
End With
RngTgt.FormattedText = RngSrc.FormattedText
End With
Set RngTgt = Nothing
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Macro to save docx to doc that checks compatibility and converts content controls to static content. | staicumihai | Word VBA | 4 | 10-12-2016 08:23 PM |
Duplicating table set in word
|
emmanpelayo | Word VBA | 2 | 08-08-2016 08:41 PM |
Is it possible to copy non-contiguous rows of a Table and paste them as a separate Table in Word?
|
Joey Cheung | Word Tables | 1 | 08-12-2014 05:15 PM |
| Content Controls - Add Table Rows | dgiromini | Word VBA | 1 | 04-11-2014 03:04 PM |
Grouping table rows to prevent individual rows from breaking across pages
|
dennist77 | Word | 1 | 10-29-2013 11:39 PM |