Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word VBA

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 01-03-2017, 03:07 PM
cepdance cepdance is offline Mac OS X Office for Mac 2011
Novice
 
Join Date: Jan 2017
Posts: 4
cepdance is on a distinguished road
Default Use Macros to add a new row in protected document


Let me start by saying the only things I know of macros is what I've read on the internet today so far.

I have a word document that's a fillable form, and in it I have 2 tables that I would like the option of adding additional rows if needed. I'd like the new row to have the same formatting as the row above it (text entry, combo drop down boxes, etc)

I found some macros code that sort of started to do what I wanted, but an error would pop up.

I now understand the process of adding the macro and using it in the table cell "on exit", And that it needs to be in a docm format- I just need the proper code to make it do what I want. Is there anywhere i can find that?

I've attached the document for reference.
Thank you for your help!
Attached Files
File Type: docm Production Show Report 2017 macro.docm (465.4 KB, 2 views)
Reply With Quote
  #2  
Old 01-03-2017, 10:30 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 2,163
gmayor is a jewel in the roughgmayor is a jewel in the roughgmayor is a jewel in the roughgmayor is a jewel in the rough
Default

Look at the example code at http://www.gmayor.com/word_vba_examples_2.htm - especially 'An alternative method of adding a row to a protected table'
__________________
Graham Mayor - MS MVP (Word)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 01-03-2017, 10:48 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,294
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Since you're using formfields, see the demonstration document in this post: http://www.msofficeforums.com/word-v...html#post38312
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #4  
Old 01-04-2017, 07:38 AM
cepdance cepdance is offline Mac OS X Office for Mac 2011
Novice
 
Join Date: Jan 2017
Posts: 4
cepdance is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Since you're using formfields, see the demonstration document in this post: http://www.msofficeforums.com/word-v...html#post38312
Thank you! When I use this code, I get this error:

Microsoft Visual Basic
Run Time Error 4605
This method or property is not available because no text is selected

Have I done something wrong?
Reply With Quote
  #5  
Old 01-04-2017, 07:41 AM
cepdance cepdance is offline Mac OS X Office for Mac 2011
Novice
 
Join Date: Jan 2017
Posts: 4
cepdance is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
Look at the example code at http://www.gmayor.com/word_vba_examples_2.htm - especially 'An alternative method of adding a row to a protected table'
Thank you! I tried using this code yesterday and I end up with the error

Microsoft Visual Basic
Run Time Error 438
Object doesn't support this property or method

Is there a step I haven't taken?

Thanks!
Reply With Quote
  #6  
Old 01-04-2017, 08:16 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 2,163
gmayor is a jewel in the roughgmayor is a jewel in the roughgmayor is a jewel in the roughgmayor is a jewel in the rough
Default

It seems you are using the Mac version of Word, which I hadn't noticed . The code is unlikely to work on the Mac version. It also won't work in tables that have split/merged cells, like those in your first table, but the PC version should work in your other tables.
__________________
Graham Mayor - MS MVP (Word)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #7  
Old 01-04-2017, 08:18 AM
cepdance cepdance is offline Mac OS X Office for Mac 2011
Novice
 
Join Date: Jan 2017
Posts: 4
cepdance is on a distinguished road
Default

I was able to make it work! I just had to rename the cells
Thank you for your help!!
Reply With Quote
Reply
Please reply to this thread with any new information or opinions.

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a Password Protected Template with Macros eking Word 3 12-20-2016 01:05 PM
Macros don't work in password protected file. Auto Excel Programming 2 06-29-2016 12:17 AM
Enable watermark in a protected document erickalves05 Word 2 10-17-2014 10:26 AM
embedded links in protected document John147 Word 1 08-10-2014 04:18 AM
Using bookmarks in a protected document Bill Stemp Word 0 10-16-2010 06:47 AM


All times are GMT -7. The time now is 09:56 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft