Fill out address fields in Word document fails.

NAVFuchs
Member Posts: 77
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;
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;
0
Comments
-
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...
- Reinhard0 -
thanks for your reply. I already tried this, but the error message does not disappear.
Any other solutions?0 -
Is it possible to solve this problem with other code or technics?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions