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 ?
0
Comments
viewtopic.php?f=23&t=33734
the key is getting the globals set up correctly
Name DataType Subtype Length
wdApp Automation 'Microsoft Word 11.0 Object Library'.Application
wdDoc Automation 'Microsoft Word 11.0 Object Library'.Document
wdRange Automation 'Microsoft Word 11.0 Object Library'.Range
TemplateName Text 250
good luck
http://www.BiloBeauty.com
http://www.autismspeaks.org
I got it to work. My problem now is to show the variables in Word.
http://sites.google.com/site/savatage99 ... edirects=0
http://www.BiloBeauty.com
http://www.autismspeaks.org
If you can't find where Insert->field is use the word help.
http://www.BiloBeauty.com
http://www.autismspeaks.org