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 / January 2006

Tip: Looking for answers? Try searching our database.

Bookmark in text form field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Infotech - 30 Dec 2005 23:50 GMT
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!
Flemming Dahl - 31 Dec 2005 00:07 GMT
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?

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.