Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    McLean, VA
    Posts
    125
    Thanks
    4
    Thanked 0 Times in 0 Posts
    I have a userform that helps me create a meeting minutes report. It has a bookmark called MeetingFrequency which offers combobox values such as Monthly, Weekly, etc. This field comes before the MeetingTitle bookmark. Since not all meeting titles require a meeting frequency to precede it, one of the values I offer my users for MeetingFrequency is "blank". When they select blank, my code sets MeetingFrequency to "". However, my report has a REF to the bookmark where the meeting title repeats on a later page, and when the bookmark is blank I get an error message where the REF field is (where I would like "nothing" to be). Is there a simple way that a very low-level VBA programmer such as myself can fix this problem? Replacing """" with a single space in my code comes close, but it results in either too many or not enough spaces in the report.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    You could try wrapping your REF in an {IF} field. Roughly: {IF {REF bmk}=TextOfErrorMessage "" {REF bmk}}.

  3. #3
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Instead of:
    {IF{REF bmk}=TextOfErrorMessage "" {REF bmk}}.
    you could use:
    {IF{REF bmk}<> "Error!*" {REF bmk}}.
    Note the required space between the '<>' and the following expression (also required after an '=').
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  4. #4
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    McLean, VA
    Posts
    125
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Thanks! I'm sure both of your reasonings are fine, but I am not having any luck with the IF statements. I attached a file showing my attempt at both of your methods. Please change the extension from docx to dotm and double click to get the userform to popup.
    Attached Files Attached Files

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    I couldn't open that document in Word 2003 for some reason. Here is a sample showing how you can use an IF field to test for the presence of a Bookmark. Press Alt+F9 to toggle between field results and field codes.

    [attachment=90412:Sample-IF-Field-WD03.doc]
    Attached Files Attached Files

  6. #6
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts
    As a quick fix, you could leave one of the spaces out of the document itself and add one to each of your options, so you'd have 'weekly ', 'monthly ' and ' ' (or before the word, if that fits in better with your document). Then do the same at the other location where the info is used - leave a space out of the text and use the one in the options instead.
    Beryl M


Posting Permissions

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