Word Automation

XavXav Member Posts: 25
Hello,

I want use the word automation for the first time. The goal is to pass parameters in a few fields in a word document.

I use Dynamics Nav 5.0 SP1 with XP SP3 and Office 2007.

I try to create a test with this code in a new form :

CompanyInfo.FIND;
CREATE(wdApp);
TemplateName := 'C:\test.dot';
wdDoc := wdApp.Documents.Add(TemplateName);
wdApp.ActiveDocument.Fields.Update;
wdRange := wdAPP.ActiveDocument.Fields.Item(1).Result;
wdRange.Text := CompanyInfo.Name;
wdRange.Bold := 1;
wdRange := wdAPP.ActiveDocument.Fields.Item(2).Result;
wdRange.Text := USERID;
wdRange.Bold := 1;
wdApp.Visible := TRUE;
wdApp.ActiveDocument.Fields.Unlink;

My problem is that the property wdApp.Documents does not exist and therefore I can not compile this code.

Is this code good ?
can you give me some ideas please ?

Comments

Sign In or Register to comment.