PDA

View Full Version : "Links" in Word 2007



matkyne
08-08-2008, 10:59 AM
I have been trying to create an automated form as a word document. I have been looking all over the interweb but I might not know the correct question to ask. So pardon the forthcoming detail:

I am trying to set up links in Word 2007 so that the same information does not have to be entered multiple times in the same multi-page document. For example on the cover page of this document, the person filling out the from will input the part number. I would then like this part number to show up automatically in the rest of the pages of the document. It seems simple enough but I just can't figure it out. If I have to sit through another 45 minute online class that shows me how to save a Word document, I will start banging my head against the wall. :banghead:

The other thing I would like to do is have one selection from a drop down list drive the answers for other drop down lists. For example, If in a drop down list I give the user the two options of "San Antonio" or "Dallas", whichever one they choose could automatically drive the information in other fields. Specifically, if "Dallas" is chosen, then automatically fill in the correct address, phone number, and contact information for the office in Dallas. It seems to me that it should go something like:

if x="Dallas"=True
then y="(XXX) XXX-XXXX" z="123 Some Street"
if x="San Antonio" . ......

I am here to learn, so beat me over the head if you must. Thanks.

CreganTur
08-08-2008, 11:10 AM
Welcome to the forum- always good to see new people!

An easy way to do this is by using bookmakrs. Go through your wor doc and put bookmarks in where you want your text to go. I would suggest using an incrementing naming system. Example: you need to put the part number in multiple times; name the bookmarks PartNum1, PartNum2, etc.

Then you can use this function behind your UserForm:

Sub UpdateFF(Fld As String, Cnt As Long, Res As String)
Dim i As Integer
For i = 1 To Cnt
ActiveDocument.Bookmarks(Fld & i).Range.Text = Res
Next
End Sub


You would call the function like this(if you had 6 PartNum bookmarks):

Dim PartNum As String

PartNum = Me.PartNum '<<<Name of textbox on UserForm where part# is entered
UpdateFF "PartNum", 6, PartNum

I've attached a small example document that shows some basics on using this idea.

macropod
08-08-2008, 03:12 PM
Hi Matkyne,

See: http://gregmaxey.mvps.org/Repeating_Data.htm
If you're using formfields, you can do all this without vba (see 'On Line Form' in the link).