navision word automation - call to member item failed

Name DataType Subtype Length
wrdApp Automation ‘Microsoft Word 11.0 Object Library’.Application
wrdDoc Automation ‘Microsoft Word 11.0 Object Library’.Document
wrdRange Automation ‘Microsoft Word 11.0 Object Library’.Range

Companyinfo.FIND;
userinfo.GET(USERID);

CREATE(wrdApp);
TemplateName:=‘c:\template.doc’;
wrdDoc:=wrdApp.Documents.Add(TemplateName);
wrdApp.ActiveDocument.Fields.Update;

wrdRange:=wrdApp.ActiveDocument.Fields.Item(1).Result;
wrdRange.Text:=USERID;
wrdRange.Bold:=1;

wrdApp.Visible:=TRUE;
wrdApp.ActiveDocument.Fields.Unlink;

when i used above coding i found following error:

“The call to member item failed.the requested member of the collection does not exist.”

and the debugger stops at the line which is underline.Pls give me any solution.thanks.

regards

vijay tiwari.

Hi Vijay,

wrdRange:=wrdApp.ActiveDocument.Fields.Item(1).Result;

what are you tring to acheive with this?

Is it giving a compile error?