Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When creating an index entry via Alt+Shift+X it inserts a code line like this at the current pointer position:

{ XE "Main entry" \t "see there" }

If I click then on Insert index to create an index table the entry is recognised and included into the index table. However, if I simply manually write this code line it is not recognised as an index entry.

What magic is happening here?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

When you press that key combination, Microsoft Word is actually creating a field. These are special structures in a Word document which add dynamic behavior to your document. You can normally tell if what you have in front of you is a field by the curly brackets.

You can also insert these fields yourself by clicking Insert -> Quick Parts -> Fields and scrolling down to the XE field.

share|improve this answer
    
Thank you Adam. Now it is clear. Can the above code for the field also be inserted via VBA? –  orschiro Dec 8 '12 at 6:55
1  
Yes it can, use: ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, Entry:= _ EntryText, CrossReference:="", _ CrossReferenceAutoText:="", BookmarkName:="", Bold:=False, _ Italic:=False –  Adam Dec 8 '12 at 23:48
    
Thank you Adam. The code is working great! Regards, Robert –  orschiro Dec 10 '12 at 8:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.