Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Selection.InsertCrossReference

23 views
Skip to first unread message

Michael

unread,
Sep 15, 2009, 5:43:39 PM9/15/09
to
Hi

i am trying to write a c# Word addin to insert cross references to
figure captions within the document.

whenever i try to use the selection.intsertCrossReference command i
get an error : System.Runtime.InteropServices.COMException
(0x800A1066): Command Failed
the code:


ord.


Document doc = WordApp.ActiveDocument;
oCRItems = doc.GetCrossReferenceItems(ref reftyp);
Array items = ((Array)(oCrossReferenceItems));

object refitem = items.GetValue(1);
object oRefType = Word.WdCaptionLabelID.wdCaptionFigure;
object oRefKind = Word.WdReferenceKind.wdEntireCaption;

WordApp.Selection.InsertCrossReference(ref
oRefType,Word.WdReferenceKind.wdEntireCaption,ref refitem,ref
nullobj,ref nullobj,ref nullobj,ref nullobj);

any suggestions on what i am doing wrong?

thanks
Michael

0 new messages