Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi

    Is it possible to check for 'field' errors? For example, I have document set up as follows:

    Page 1 -> Front Cover
    Page 2 -> Change History
    Page 3 -> TOC
    Page 4 -> Copyright Information
    Page 5-6 -> Course Summary
    Page 7 -> Part 1 section
    Page 8-15 -> Contents for Part 1
    Page 16-> Part 2 section
    Page 17-22 -> Contents for Part 2

    The headings from page 4 has been setup as follows:
    Code:
    { STYLEREF  "Part Section" \n \p \w  \* MERGEFORMAT } { STYLEREF  "Heading 1"  \* MERGEFORMAT }
    Unfortuantely, it is possible that some documents will *not* have the 'Part n' section. For those documents, the headers goes all wrong & it shows the following:
    Code:
    Error! No text of specified style in document. { STYLEREF  "Heading 1"  \* MERGEFORMAT }
    Therefore, is there a way of say checking for field errors/return and if no 'Part section' defined then that field displays nothing otherwise displays the 'Part n' & then the heading text. Perhaps, there is some other way of defining the header - I can't find it though :-(.
    Thanks.
    Robie

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You can use an IF field for this:

    { IF { STYLEREF "Part Section" \n \p \w \* MERGEFORMAT }="Error! Style not defined." "" "{ STYLEREF "Part Section" \n \p \w \* MERGEFORMAT }" }

    Note: this will only work in the English language version of Word, because it uses the literal error text.

  3. #3
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts
    I use { If { Styleref ...}="Error! No text of specified style in document." "" "{ Styleref...}" }

    Which checks for the error message and uses a blank string instead.

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Quote Originally Posted by StuartR View Post
    I use { If { Styleref ...}="Error! No text of specified style in document." "" "{ Styleref...}" }

    Which checks for the error message and uses a blank string instead.
    Hi Stuart,

    You could simply that to:
    {If{Styleref ...}<> "Error!*" {Styleref...}}
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  5. #5
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Hans, Stuart and Macropod (will try your method sometime).

    Your suggestions just worked brilliantly. You are all so wanderful - a big THANKS.
    Thanks.
    Robie

Posting Permissions

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