Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2006

Tip: Looking for answers? Try searching our database.

Repeating Form Fields in new Table Rows

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
LPS - 19 May 2006 14:46 GMT
I am using Word 2000 and need to have a new table row containing protected
form fields automatically generate when the TAB key is pressed at the end of
the last row, so that the new row automatically contains the same form
fields.  

I have reviewed previous questions and found some with references to macros
and I have tried the macro below, with no success.  Can anyone tell me what I
am doing wrong?  I am not famliar with macros, and I do not understand the
macro below, therefore I am probably making some major mistakes.

   
Sub addrow()

' Macro created 02/02/03 by Doug Robbins

' To add a new row to a table containing formfields in every column

' automatically on exit from the last cell in the present last row of the
' Table

Dim rownum As Integer, i As Integer

ActiveDocument.Unprotect

ActiveDocument.Tables(1).Rows.Add

rownum = ActiveDocument.Tables(1).Rows.Count

For i = 1 To ActiveDocument.Tables(1).Columns.Count

   ActiveDocument.FormFields.Add
Range:=ActiveDocument.Tables(1).Cell(rownum, i).Range,
Type:=wdFieldFormTextInput

Next i

ActiveDocument.Tables(1).Cell(ActiveDocument.Tables(1).Rows.Count,
ActiveDocument.Tables(1).Columns.Count).Range.FormFields(1).ExitMacro =
"addrow"

ActiveDocument.Tables(1).Cell(ActiveDocument.Tables(1).Rows.Count,
1).Range.FormFields(1).Select

ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

Thanks for any advise / guidance given,
LPS

Signature

LPS

Jean-Guy Marcil - 19 May 2006 19:28 GMT
LPS was telling us:
LPS nous racontait que :

> I am using Word 2000 and need to have a new table row containing
> protected form fields automatically generate when the TAB key is
[quoted text clipped - 3 lines]
> I have reviewed previous questions and found some with references to
> macros and I have tried the macro below, with no success.  Can anyone

"no success"...
This is a little vague.
What is actually happening when you try the macro (i.e. when you hit TAB at
the end of the last row)?

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

Cindy M  -WordMVP- - 20 May 2006 19:41 GMT
This duplicate question has received replies in the
vba.general newsgroup.
   
Cindy Meister

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.