|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Help please adding a macro to add a table row to a content control table on exit
Hi I'm creating a fillable form in Word - I have used a number of tables and for some of them I'd like a new row to be created when the user exits, so that if they have more information they can add it without trying to add rows themselves. I found a macro on this forum but it then adds a row to all of the tables in my document on exit, and some of them don't need this. Could anyone help me to apply the macro just to specific tables? I have attached my document, with the macro which I have tried to amend to just apply to the third and fourth tables but it isn't working. I am a complete novice so appreciate any help! Thank you |
#2
|
||||
|
||||
For example:
Code:
'The following code conditionally adds a new row, with content controls, to the designated tables. Dim i As Long, j As Long, t As Long, Prot As Variant Const Pwd As String = "" 'Insert password (if any) here With CCtrl 'Check that the Content Control is within our table. t = ActiveDocument.Range(0, CCtrl.Range.Start).Tables.Count Select Case t Case 3, 4 Case Else: Exit Sub End Select 'Get the number of ContentControls in the table
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
content control, macro help, macro in word |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA Adding Rows To Table With Content Control | lord_kaiser | Word VBA | 2 | 08-01-2020 01:01 AM |
Edit table in content control | denise do rocio maciel | Word VBA | 2 | 01-03-2016 11:59 PM |
VBA error Content Control On Exit | jec1 | Word VBA | 5 | 08-16-2014 08:14 PM |
Deleting a table from a content control -- preserving the content control | BrainSlugs83 | Word Tables | 8 | 11-14-2013 03:06 AM |
Clearing content control tick box within table | jillapass | Word VBA | 1 | 08-08-2012 04:58 PM |