Range.InsertCrossReference Method 

Inserts a cross-reference to a heading, bookmark, footnote, or endnote, or to an item for which a caption label is defined (for example, an equation, figure, or table).

Namespace: Microsoft.Office.Interop.Word
Assembly: Microsoft.Office.Interop.Word (in microsoft.office.interop.word.dll)

Usage

Dim ReferenceType As Object
Dim ReferenceKind As WdReferenceKind
Dim ReferenceItem As Object
Dim InsertAsHyperlink As Object
Dim IncludePosition As Object
Dim SeparateNumbers As Object
Dim SeparatorString As Object
Dim range1 As Range
range1.InsertCrossReference(ReferenceType, ReferenceKind, ReferenceItem, InsertAsHyperlink, IncludePosition, SeparateNumbers, SeparatorString)

Syntax

Sub InsertCrossReference( _
    <InAttribute()> ByRef ReferenceType As Object, _
    <InAttribute()> ByVal ReferenceKind As WdReferenceKind, _
    <InAttribute()> ByRef ReferenceItem As Object, _
    <InAttribute()> Optional ByRef InsertAsHyperlink As Object, _
    <InAttribute()> Optional ByRef IncludePosition As Object, _
    <InAttribute()> Optional ByRef SeparateNumbers As Object, _
    <InAttribute()> Optional ByRef SeparatorString As Object _
)
void InsertCrossReference(
    [In] ref object ReferenceType, 
    [In] WdReferenceKind ReferenceKind, 
    [In] ref object ReferenceItem, 
    [In, Optional] ref object InsertAsHyperlink, 
    [In, Optional] ref object IncludePosition, 
    [In, Optional] ref object SeparateNumbers, 
    [In, Optional] ref object SeparatorString
);
public: Void InsertCrossReference(
    &Object^ ReferenceType, 
    WdReferenceKind^ ReferenceKind, 
    &Object^ ReferenceItem, 
    &Object^ InsertAsHyperlink, 
    &Object^ IncludePosition, 
    &Object^ SeparateNumbers, 
    &Object^ SeparatorString
);
public void InsertCrossReference(
    /*in*/System.Object ReferenceType, 
    /*in*/WdReferenceKind ReferenceKind, 
    /*in*/System.Object ReferenceItem, 
    /*in*/System.Object InsertAsHyperlink, 
    /*in*/System.Object IncludePosition, 
    /*in*/System.Object SeparateNumbers, 
    /*in*/System.Object SeparatorString
);
function InsertCrossReference(
     ReferenceType : Object, 
     ReferenceKind : WdReferenceKind, 
     ReferenceItem : Object, 
     InsertAsHyperlink : Object, 
     IncludePosition : Object, 
     SeparateNumbers : Object, 
     SeparatorString : Object
);

Parameters

  • ReferenceType
    Required Object. The type of item for which a cross-reference is to be inserted. Can be any WdReferenceType or WdCaptionLabelID constant or a user defined caption label.
  • ReferenceKind
    Required WdReferenceKind. The information to be included in the cross-reference.
  • ReferenceItem
    Required Object. If ReferenceType is wdRefTypeBookmark, this argument specifies a bookmark name. For all other ReferenceType values, this argument specifies the item number or name in the Reference type box in the Cross-reference dialog box. Use the GetCrossReferenceItems method to return a list of item names that can be used with this argument.
  • InsertAsHyperlink
    Optional Object. True to insert the cross-reference as a hyperlink to the referenced item.
  • IncludePosition
    Optional Object. True to insert "above" or "below," depending on the location of the reference item in relation to the cross-reference.
  • SeparateNumbers
    Optional Object. True to use a separator to separate the numbers from the associated text. (Use only if the ReferenceType parameter is set to wdRefTypeNumberedItem and the ReferenceKind parameter is set to wdNumberFullContext.)
  • SeparatorString
    Optional Object. Specifies the string to use as a separator if the SeparateNumbers parameter is set to True.

Remarks

If you specify wdPageNumber for the value of ReferenceKind, you may need to repaginate the document in order to see the correct cross-reference information.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000

Target Platforms

See Also

Reference

Range Interface
Microsoft.Office.Interop.Word Namespace

Other Resources

Range Members