Also, some operations on fields can only be performed using shortcuts or via. Using those shortcuts will help you save time and mouse clicks. By default, a number of keyboard shortcuts have been assigned to operations related to Word fields. It's a bit more round-about than accessing what GetCrossReferences returns, but it should be more reliable. Fields in Word are used for many purposes such as page numbers, cross-references and tables of contents. Need to analyze what characteristics of the field codes you need to pick up in order to populate your list. This is what's actually behind the cross references and you can access them directly - you just The Alt+f9 toggle appears to be a function of the status of the work station (client) computer.
If you press Alt+F9 it will toggle field results to field code display. In that case, it should be possible to work with the FIELDS collection of the document. But now I realize I was thinking "Revisions" and you mean Cross References - sorry about misunderstanding I meant to loop the paragraphs (or sections - something small enough to reliably return the members of the collection) and check their Ranges for the References. No, not the styles - your question is about the References collection, if I read your post correctly. (Opt+F9 or Fn+Opt+F9) See Keyboard Shortcuts that control fields below. Keys on the Macintosh are similar but different. ObjDoc.GetCrossReferenceItems(customhead) So, instead of Alt+F9, you would press Fn+Alt+F9 (or edit the BIOS so that function keys act as described in documentation for programs). DoEvents() customhead = cboreftype.SelectedItem I'm using visual studio 2013 to write an add-in for word 2013.ĭim objApp As Word.Application = ĭim objDoc As Word.Document = objApp.ActiveDocument I've added my code below just for information. So I'm wondering of any decent workaround exists for this behavior. But no decent explanations and/or workarounds have been provided. I have used F9 to reveal the codes and everything looks fine. ctrl-a, ctrl-shift-F11 to unlock them all just in case. When you create a cross-reference to text enclosed in a bookmark that you created in the active document as described in Bookmarks: The Basics or to the text enclosed in a hidden bookmark that Word creates for a heading, numbered item, figure caption, or table caption, Word creates a REF field containing the name of the bookmark. items indicating they are not locked fields. Right-mouse on the cross-references does not show any grey'd out.
I've been searching around the internet and the problem has been brought up a number of times before. Updating the cross-references or TOC individually work. Whenever I run the code in the debug mode it works fine.
6 while there should be more than 100 references. Sometimes it provides me with the correct number of references but sometimes it limits However, the function WdReferenceType seems to be quite unreliable. I'm writing a function that should populate a listbox with all references to a custom referencetype.