InsertCrossReference On a Heading with no text RRS feed

  • Question

  • In WORD 2010, Selection.InsertCrossReference fails for a Heading with no text (i.e., heading number but no text after it).  It works with tables and figures with no text after the number.  In the following example Heading 2.0 fails (4198), but Figure 2-2 does not fail.  The Insert Cross-reference menu option is successful for both instances.  However, if a macro is recorded to cross-reference to a heading and that code fails.  Is there a solution?



    1.0 Introduction


    2.1  Approach

    Figure 2-1: Diagram

    Figure 2-2


    strListTitle = "Heading" 'strListTitle = "Table" 'strListTitle = "Appendix_Table" 'strListTitle = "Figure" 'strListTitle = "Appendix_Figure" RefKind = wdOnlyLabelAndNumber' RefKind = wdNumberNoContextSelectedItem = 2 Selection.InsertCrossReference ReferenceType:=strListTitle, _ ReferenceKind:= RefKind, _ ReferenceItem:=CStr(SelectedItem), _ InsertAsHyperlink:=True, _ IncludePosition:=False, _ SeparateNumbers:=False, _ SeparatorString:=" "


    Thursday, November 20, 2014 5:29 PM


  • Hi USNA80,

    As far as I know, a heading the the word document should have text, I usually insert headings by selecting some text>Home>Style>Heading1/Heading2/Heading3, if I don't select anything, it will treat the whole line as the text of the heading. Every time I choose Home>Insert>Cross Reference>Heading, it'll list all the headings with their text.

    I think in your case, "2.0" may not me a heading. If I misunderstand you, please post the error message when running the recorded macro, and upload the word document file in OneDrive so that I can reproduce your problem.

    Thank you.

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, November 21, 2014 7:29 AM