I have an Autonew script that inserts a text number into a table row. I want
the number to go into a text form field. When I place the bookmark in the
form field and protect the document, instead of the number going into the
text field, it pushes the text field to the right and inserts the number
into the plain table row. I'm going to be exporting this data at a later
date so I need it in that text field. How is this possible?
Thanks!
Hi
You cnat have a bookmark within at formfield... but you can write to the
formfield
From Word's own VBA help
This example sets the content of the form field named "Text1" to "Name."
ActiveDocument.FormFields("Text1").Result = "Name"
This example retrieves the type of the first form field in section two.
myType = ActiveDocument.Sections(2).Range.FormFields(1).Type
Select Case myType
Case wdFieldFormTextInput
thetype = "TextBox"
Case wdFieldFormDropDown
thetype = "DropDown"
Case wdFieldFormCheckBox
thetype = "CheckBox"
End Select
This example displays the name of the first form field in the selection.
If Selection.FormFields.Count > 0 Then
MsgBox Selection.FormFields(1).Name
End If
Cheers,
Flemming
>I have an Autonew script that inserts a text number into a table row. I
>want the number to go into a text form field. When I place the bookmark in
[quoted text clipped - 4 lines]
>
> Thanks!
Infotech - 03 Jan 2006 17:29 GMT
Thanks for the prompt reply! I'm trying to use that example but I can't get
the same results as the line of code below gives me.
ActiveDocument.Bookmarks("SRNumb").Range.InsertBefore Format(SRNumb,
"JAB-0000#")
The above line puts the SR Number into the table row that the Bookmark
SRNumb is in, formatted like this: JAB-0002, JAB-0003, or whatever depending
on what the next number should be.
I tried changing that line so it'll update text field 147 but I can't seem
to figure out how to call the variable and format it. What should go after
the = sign? Or is there a better command to use?
ActiveDocument.FormFields("Text147").Result =
Thanks again!
> Hi
>
[quoted text clipped - 34 lines]
>>
>> Thanks!
Doug Robbins - Word MVP - 03 Jan 2006 18:40 GMT
ActiveDocument.FormFields("Text147").Result = Format(SRNumb, "JAB-0000#")

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Thanks for the prompt reply! I'm trying to use that example but I can't
> get the same results as the line of code below gives me.
[quoted text clipped - 52 lines]
>>>
>>> Thanks!
Infotech - 03 Jan 2006 19:23 GMT
Thanks!
--
Infotech
> ActiveDocument.FormFields("Text147").Result = Format(SRNumb, "JAB-0000#")
>
[quoted text clipped - 52 lines]
>>>>the number into the plain table row. I'm going to be exporting this data
>>>>at a later date so I need it in that text field. How is this possible?