Consulting

Results 1 to 3 of 3

Thread: "Links" in Word 2007

  1. #1
    VBAX Newbie
    Joined
    Aug 2008
    Posts
    1
    Location

    "Links" in Word 2007

    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.

    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.

  2. #2
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,676
    Location
    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:

    [vba]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
    [/vba]

    You would call the function like this(if you had 6 PartNum bookmarks):
    [vba]
    Dim PartNum As String

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

    I've attached a small example document that shows some basics on using this idea.
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


  3. #3
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    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).
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •