Lowercase cross-references in Word 2002/XP?
October 19, 2007 2:08 AM   Subscribe

How do I get (and keep) lowercase cross-references in Word 2002/XP?

The problem is this:
I have a document with figures named something like: Figure 1 - Diagram of insanity

I want to reference the figure in the text like this, "for my recent mental health, see figure 1". But if insert a cross-reference the normal way by Cross-reference on the Insert menu, I get, "for my recent mental health, see Figure 1".

I have solved this with a macro that loops through all cross-references and changes the text to lowercase. The macro looks something like this:
For Each storyRange In ActiveDocument.StoryRanges
    For Each field In storyRange.Fields
        field.Update
        If field.Type = wdFieldRef And field.Result.Words.Count 

This works fine and the references stays that way even if I save and close/reopen the document. But now I have noticed that when I try to print the document, all cross-references update and the text returns to the unwanted casing. I have tried toggling the "Update fields" checkbox at Tools > Options... > Print tab > Printing options but without any change in behavior. Is this a bug(feature)? Should I write the above macro in some other way? And if this is unsolvable (upgrading Word is not an option) is there a macro that replaces all fields with plain text versions? I guess I could resort to saving a copy of the document and execute this macro every time I want to print.
posted by mnsc to Computers & Internet (3 answers total)
 
Best answer: If you right click on the reference in your document and choose "Edit Field" then next to Format: choose "Lower Case". That should keep it lower cased regardless of updates.

I'll bet you can modify your macro to apply this automatically too, something like Field.Format = wdMagicConstantForLowerCase
posted by samj at 2:58 AM on October 19, 2007


Response by poster: Thank you! That works just as expected and is much better than executing macros after updating fields.

That was my first askmefi so now I have beheld the blinding light of knowledge that is the hivemind! Yey!

Rating: High Quality Answer...VERRY NICE....Great Service...will buy Again!!! A++++++++++
posted by mnsc at 5:07 AM on October 19, 2007


Response by poster: Now I noticed that the last bit of the macro above got cut since I didn't escape the <>. The condition after the <> was:
field.Result.Words.Count <= 2

And the code excuted if those conditions were met was:
field.Result.Text = LCase(field.Result.Text)

I didn't find any wdMagicConstantForLowerCase but to permanently change the casing of all the fields present in the document I changed the field code by changing the above line to:
field.Code.Text = field.Code.Text & " \* lower "

I am happy now.
posted by mnsc at 5:24 AM on October 19, 2007


« Older Help me paint even horizontal lines on a cotton...   |   What are you going to do with your life?! Newer »
This thread is closed to new comments.