Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to clear textinput in 1 row of table via macro

Status
Not open for further replies.

YACHTIE

Technical User
Feb 17, 2004
77
CA
Hello again,

Am struggling with additional problem within the same routine , when the table is added it contains the previous row's text input.
thought the following would clear it but it does not
Code:
ActiveDocument.FormFields(1).TextInput.Clear
I think I need to identify the specific row but have no idea how...

TIA
 
Y,

What Table? You have a form field. Don't understand.

Skip,

[red]Be advised:[/red] [glasses]
Alcohol and Calculus do not mix!
If you drink, don't derive! [tongue]
 
Sorry, but here is the code that generates the additional row in a table in a form document that is given me a headache by now:
Code:
Sub CopyTableRow_Click()
'
' Add new Row Macro to table in forms Word document by clicking a Command Button on the form.
' 
' Unlock the document
    ActiveDocument.Unprotect
    'Position cursor in table
    ActiveDocument.Bookmarks("Text32").Range.Fields(1).Result.Select
    Selection.MoveRight Unit:=wdCharacter, Count:=9, Extend:=wdExtend
    Selection.Copy
    Selection.MoveDown Unit:=wdLine, Count:=1
    Selection.PasteAppendTable
[b]ActiveDocument.FormFields(1).TextInput.Clear[/b]
     ' Lock the document
    ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End Sub

Works fine except I need to clear the textinput of the row just added by the above routine, cannot use bookmarks as the location changes depending on how many additional rows are added in the doc.

Hope you can help me out here
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top