Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-26-2021, 04:41 AM
graw76 graw76 is offline Help please adding a macro to add a table row to a content control table on exit Windows 10 Help please adding a macro to add a table row to a content control table on exit Office 2019
Novice
Help please adding a macro to add a table row to a content control table on exit
 
Join Date: Mar 2021
Posts: 1
graw76 is on a distinguished road
Smile 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
Attached Files
File Type: docm After Action Review - Client Review Template.docm (34.4 KB, 9 views)
Reply With Quote
  #2  
Old 03-26-2021, 03:37 PM
macropod's Avatar
macropod macropod is online now Help please adding a macro to add a table row to a content control table on exit Windows 10 Help please adding a macro to add a table row to a content control table on exit Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
Reply

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
Help please adding a macro to add a table row to a content control table on exit Edit table in content control denise do rocio maciel Word VBA 2 01-03-2016 11:59 PM
Help please adding a macro to add a table row to a content control table on exit VBA error Content Control On Exit jec1 Word VBA 5 08-16-2014 08:14 PM
Help please adding a macro to add a table row to a content control table on exit Deleting a table from a content control -- preserving the content control BrainSlugs83 Word Tables 8 11-14-2013 03:06 AM
Help please adding a macro to add a table row to a content control table on exit Clearing content control tick box within table jillapass Word VBA 1 08-08-2012 04:58 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:07 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft