Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Synchronizing two form fields.
As someone inputs information into one form field how do I get it to be copied to either another form entry or any other part of the same word document? -- amoss |
#2
|
|||
|
|||
amoss Wrote: As someone inputs information into one form field how do I get it to be copied to either another form entry or any other part of the same word document? There are a couple of ways to do this depending upon what exactly you mean by "As someone inputs...." If you mean "after a person types in info. into the form field and then hits enter or TABs away to the next field", then you can simply write a macro that functions On Exit (double-clicking an unlocked form-field will show an On Entry and On Exit properties that allow you to specify macro names that should be run accordingly). To get the info. to be copied from one field into another: * Make a macro called (CopyInfo; or whatever name you want to give it); go to Tools-Macros-Macros... Then type in a name for the macro, select a location (eg associate the macro with the particular document instead of with Normal.dot so that any other Word document you create won't have that macro saved as worthless overhead.) And then hit the Create button. This will bring you into the Macro VBA environment. * Type in the code Code: -------------------- ActiveDocument.Formfields("txtOriginalInfo").Resul t = _ ActiveDocument.FormFields("txtInfoCopy").Result -------------------- where "txtOriginalInfo" is the name of the field that you want the person to enter the info into (and the one where this macro will be run On Exit) and "txtCopyInfo" is the field that will have the copy of the info. * Save Macro and go back to the Word document. * Double-click the unprotected field ("txtOriginalInfo") and type the name of the macro you created (CopyInfo) into the On Exit property. * Also if you haven't already done so, name the field to reflect what you wrote in the macro by changing the name property (and do the same for the "txtCopyInfo" field) * Save the document and you're good to go! If when you said "As someone inputs...." you meant "the person hits a letter and the letter become visible in two fields at exactly the same time", then you're question becomes much more tricky (something that I won't try to answer in this post). Basically for this, you would have to run a macro On Entry which looks at your keystrokes as you type them in and echo that into the other field. I'm not sure if it was this forum, but I remember reading a post about an Autocomplete macro for FormFields which acts similar to the address-bar in IE that fills in what it expects you to type in next. If I remember correctly, this macro went more into having something happen as keys were being pressed; in that case instead of having the keystrokes echoed in a different field, it had to look up similar words and write out those to the current field. Unless you were trying to make your document really flashy, I'd just stick with the simple macro that I gave in the first solution. P.S. You can also use conditional statements to automate more of your document. For example, suppose you had a field for the zip-code and you had a commonly typed in zip-code (like your home address), then you might have this code in your macro: Code: -------------------- If ActiveDocument.FormFields("homeZipCode").Result = "14218" Then ActiveDocuments.FormFields("homeCity").Result = "Buffalo" ActiveDocuments.FormFields("homeState").Result = "NY" End If -------------------- EDIT: I just went back into Word and realized I had misnamed some of the properties for the FormField. The name of the formfield can be entered in the "Bookmark:" field in the "Field Settings" section. And the Macro that you want to run on exit out of the formfield is listed in the drop-down list under "Exit:" under the "Run macro on" section. -- Pyth007 |
#3
|
|||
|
|||
No macro is needed for this, just a cross-reference to the bookmark of your
form field. See http://gregmaxey.mvps.org/Repeating_Data.htm -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "amoss" wrote in message ... As someone inputs information into one form field how do I get it to be copied to either another form entry or any other part of the same word document? -- amoss |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Blank return for drop-down form fields | Microsoft Word Help | |||
Mailmerge vs. form fields | Mailmerge | |||
How do I use a form then mailmerge without losing the form fields | Mailmerge | |||
Having multiple form fields automatically updated | Microsoft Word Help | |||
Email a protected document that contains Text Form Fields | New Users |