Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-09-2019, 04:26 AM
njt-71 njt-71 is offline Help with using VBA to add a row to a table in a protected document Windows 7 32bit Help with using VBA to add a row to a table in a protected document Office 2010
Novice
Help with using VBA to add a row to a table in a protected document
 
Join Date: Sep 2019
Posts: 2
njt-71 is on a distinguished road
Default Help with using VBA to add a row to a table in a protected document

Hi



I have a form field document which I need the user to be able to add rows to whilst it is still protected.

I have used the VBA code at VBA Code Examples (2) but although it works to add a new row the cursor jumps back to the adress field at the top of the first page instead of to the added row.

I have attached the form so you can see what I mean.

Can anyone please help as it's driving me demented!!

Thanks
Attached Files
File Type: dotm Photo Log.dotm (28.8 KB, 6 views)
Reply With Quote
  #2  
Old 09-09-2019, 06:25 AM
gmayor's Avatar
gmayor gmayor is offline Help with using VBA to add a row to a table in a protected document Windows 10 Help with using VBA to add a row to a table in a protected document Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

It is not helped by the use of two tables and a mixture of content controls and form fields. Frankly it would be better if you used form fields throughout - see attached. The code will fire when you click out of the last content control.

Normally I would recommend locking the controls, as some fool will accidentally delete them, so I have only locked the controls in the table. The newly added ones are not locked while testing, but you can easily fix that in the code by releasing the three lines of code that lock them.

You may find Insert Content Control Add-In useful.
Attached Files
File Type: docm Photo Log.docm (53.0 KB, 6 views)
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 09-10-2019, 01:57 AM
njt-71 njt-71 is offline Help with using VBA to add a row to a table in a protected document Windows 7 32bit Help with using VBA to add a row to a table in a protected document Office 2010
Novice
Help with using VBA to add a row to a table in a protected document
 
Join Date: Sep 2019
Posts: 2
njt-71 is on a distinguished road
Default

Thank you!!
Reply With Quote
  #4  
Old 09-11-2019, 01:23 AM
macropod's Avatar
macropod macropod is offline Help with using VBA to add a row to a table in a protected document Windows 7 64bit Help with using VBA to add a row to a table in a protected document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

See also:

Adding a new row to a table in a document with formfields:
Macro to add row to table in a Word form

Adding a new row to a table in a document with content controls:
Code to add new row in table
Macro to add row to table in a Word form
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with using VBA to add a row to a table in a protected document Use Macros to add a new row in protected document cepdance Word VBA 6 01-04-2017 08:18 AM
Help with using VBA to add a row to a table in a protected document Macro to replace Image, Numbers in Table and in multiple protected word document balaji Word VBA 10 03-24-2016 02:11 AM
Help with using VBA to add a row to a table in a protected document Protecting a document; allow sections to be edited - spacing in table cells when protected dwciardi Word 3 09-30-2015 01:03 PM
Autoexpand Table on Protected Sheet Catalin.B Excel 0 09-07-2014 07:03 AM
Using bookmarks in a protected document Bill Stemp Word 0 10-16-2010 06:47 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:35 AM.


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