Results 1 to 9 of 9
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Ephrata, Washington, USA
    Posts
    683
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automatic insert of data (2003)

    I am trying to create a document that will be somewhat idiot proof, so I'm creating a template and trying to automate the document as much as possible. One thing I would love to do is have "fields" that automatically populate based on an initial entry into another "field." Please note that I have never worked with field codes, so this may be easily accomplished by you and yet a mystery to me.

    For instance: User types a number (or text) in the title of a document (probably into a field of some sort). This same number (text) is used many times throught the document. I would like the other places where that number should show up to be automatically updated when the first instance is created.

    Specifically, this is a contract document where the user types the contract number in the title. This contract number is referred to in many places. Once the user types it in the title, I want all the other places to contain the updated contract number. I know this is a field thing or a cross reference thing. But, it escapes me how to do this so simply that the user doesn't have to manipulate anything.. just go to that field/box or whatever.. type the contract number and voila.. it appears in all the other boxes/fields throughout the 90 page document.

    Is this possible?

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic insert of data (2003)

    Hi Melanie:
    There are a several ways to do this.
    Method 1:
    Bookmark the first entry of the word or phrase.
    Use a REF field with the bookmark name where you want it to repeat. i.e. press Ctrl+F9 & type REF BookmarkName so that it looks like this:

    { REF BookmarkName }

    where BookmarkName is the actual name of the bookmark.

    Method 2:
    Similar to method one except right click & drag the first entry (or field) to each spot that you want the entry to appear. When you release the mouse, one option will be "Link here". Choose that option. An advantage to this method is that the link field will include a "a" switch that causes it to update immediately. You can toggle viewing the field code by pressing Alt+F9.

    Method 3:
    Some of the information (such as Title, Subject, Author) are doc properties & you can retrieve the information from those by using Doc Property fields. e.g. to retrieve the Author, just use:

    { docproperty "author" }

    where the curly brackets are inserted by pressing Ctrl+F9, not typed.

    In addition, you may decide that you want to use a form that can be protected (so user's are limited in what edits they can make). Depending upon your needs, that may be a solution & you would still use the above methods for repeating information. However, some of Word's features are disabled when a document is protected.
    Hope this helps,

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Automatic insert of data (2003)

    A fourth way, using STYLEREF fields, is illustrated in <post#=389256>post 389256</post#>.

  4. #4
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic insert of data (2003)

    The only <img src=/S/2cents.gif border=0 alt=2cents width=15 height=15> worth I'd add to what's been posted is to ask if there are multiple sections in the document, particularly header/ footer, that might contain updatable fields. Users will need to know a bit about updating of on-screen view and the quirks of some sections "apparently" not updating in coincidence with others.

    Alan

  5. #5
    New Lounger
    Join Date
    Sep 2004
    Location
    New York, New York, Zambia
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic insert of data (2003)

    I am trying this as a solution to my query in Post 409268: "Link in Word to Excel (Word & Excel 2002)." Once I build a file like 10-389256-StyleRefDemo.doc from jscher2000, what if I don't want the form into which the data is entered to appear in the final version of the document? I tried formatting the table as hidden text but an update then hides all the results appearing in the fields. Is there a way to convert the fields to text so that the table serving as the form can ultimately be deleted? Thanks.

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Automatic insert of data (2003)

    3 steps: update all fields (Ctrl+A, F9), unlink them (Ctrl+Shift+F9), delete the first section. It could be packaged as a little macro.

  7. #7
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Automatic insert of data (2003)

    Hi Jefferson,

    The first two steps would be easy enough as a macro:

    Sub LockFields()
    ActiveDocument.Fields.Update
    ActiveDocument.Fields.Unlink
    End Sub

    but selecting the correct embedded object would seem to be problematic if there is more than one, since you wouldn't necessarily know its ID. Any ideas about that?

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Automatic insert of data (2003)

    I was thinking of a very simplistic approach, just blowing away the first section:

    ActiveDocument.Sections(1).Range.Delete

    As you note, there could be multiple tables or other objects in that first section. One could write more complicated code if it was important to preserve some parts while deleting others, but it would be difficult to avoid absolute references (e.g., Tables(1) and so on).

  9. #9
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Ephrata, Washington, USA
    Posts
    683
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic insert of data (2003)

    The document is only one section, but it does contain a header with the contract number in it (which is the variable). The suggestions you all have provided are great. I am delving into an area of Word that I knew existed but have never used before. This is good for me. A learning experience. Right now, it's a bit like confusing, but you've put me on the right track. Thank yoU!

Posting Permissions

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