Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Jun 2008
    Baltimore, Maryland, USA
    Thanked 0 Times in 0 Posts

    'OR' Symbol or character (Word For Windows)

    Good afternoon.

    I am attempting to construct a macro (rather, modify an existing one) that uses field codes from a separate program, and would prevent the user of the program from being able to print a document without first entering required characters in the referenced program field(s). I have discovered that if a macro with field Codes is installed in a Word document, Word will not allow the user to print the document unless the fields corresponding to the codes have recognizable data entered in them If a user attempts to do so, an error message (Syntax error) page prints instead. I can use this behavior to my advantage so as to ensure proper document preparation in an automated way.

    The problem I am encountering is in accommodating a contingency. I need to write the code such that more than one possible character entry will be interpreted as "0". I have already written a macro (containing bookmarks for the field codes) that effectively facilitates this interpretation for one character. The missing ingredient in my recipe is the proper representation of the concept of "OR" - i.e. - "If FIELD CODE #5 = either "X' OR 'Y', then interpret FIELD CODE # 5 as '0'."

    Here is the original version of the bookmark, which works as intended (for one specific character - "X"): { IF <<Point Field 9926>> = X 0 <<Point Field 9926>> }

    Here us what I need, effectively: { IF <<Point Field 9926>> = X OR "Y" 0 <<Point Field 9926>> }

    The result of using the second bookmark shown above is the generation of a Syntax Error, which occurs when either an "x" or a "Y" is entered in the screen field (9926). I tried adding parentheses as thus - (X OR "Y" 0) - but that did not solve the problem.

    I have attached a Word document that contains each of the entire macros, with the formatting intact, which allows for modification to the code. It also provides more details about the contextual application, as well as the actyal variable in the macro.

    Can anyone tell me the correct way to represent the "'X' OR 'Y'" part of the code? Or is it a matter of proper placement of parentheses?

    Also - If there is a better way to ensure screen data entry - a way to "force" a user to enter data in required fields in order to print a document, please let me know. The technique described above simply exploits an incidental performance characteristic of Word. There may be a feature of Word that was specifically designed to achieve that effect, perhaps in a better way.

    Any help would be greatly appreciated. Thank you very much.

    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: 'OR' Symbol or character (Word For Windows)

    Reposted in the Word forum. To prevent duplication and confusion, this thread is locked. Please post all replies in the thread starting at <post:=717,011>post 717,011</post:>.

Posting Permissions

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