Fill out address fields in Word document fails.

NAVFuchsNAVFuchs Member Posts: 76
edited 2013-02-12 in NAV Three Tier
I was updating a function form Navision 2.6 that uses Automation Objects to NAV 2013 with DotNet.

The functions opens a word document and fills aut the address fields. I just moved the functions from Automation
to dotnet Variable and filled aut the proper function with some minor changes.

NAV 2013 RTC opens the document, but when I try to select the fields in the word-document with the "item"-property
wdApp.ActiveDocument.Fields.Item(i).Result, I always get the error messsage "Item is not a property"

Does anybody know, how to change the code to be get working.


IF NOT ISSERVICETIER THEN BEGIN
CREATE(wdApp);
wdDoc := wdApp.Documents.AddOld(TempName);
wdApp.ActiveDocument.Fields.Update;
END;

Name := "Job Title" + ' ' + Name;
AdrFormat.ContactAddr(AdrInteressent,lContact);
AdrFormat.ContactAddr(AdrKontaktperson,pContactPerson);


FOR i := 1 TO 6 DO BEGIN
wdRange := wdApp.ActiveDocument.Fields.Item(i).Result;
wdRange.Text := AdrKontaktperson;
END;

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

Comments

  • ReinhardReinhard Member Posts: 249
    All I can tell you is that in the symbol menu "Item" is under "Methods" not "Properties"
    Here's what I would try, although it's just a suggestion.

    Replace:
    wdRange := wdApp.ActiveDocument.Fields.Item(i).Result;
    

    with:
    wdFields := wdApp.ActiveDocument.Fields;
    wdRange := wdFields.Item(i).Result;
    

    Something alone those lines...
    - Reinhard
  • NAVFuchsNAVFuchs Member Posts: 76
    thanks for your reply. I already tried this, but the error message does not disappear.

    Any other solutions?
  • NAVFuchsNAVFuchs Member Posts: 76
    Is it possible to solve this problem with other code or technics?
Sign In or Register to comment.