Please see the code below. Every time the code runs I get the following error:
Invalid assignment. It is not possible to assign a_Documentment to a Document.
Code:
CREATE(wdApp);
TemplateName := 'c:\windows\desktop\SecondDem.dot';
wdDoc := wdApp.Documents.Add(TemplateName); //<<<-Error on this line
wdApp.ActiveDocument.Fields.Update;
Please note that the correct template does open prior to the error.
Bill Benefiel
Manager of Information Systems
Overhead Door Company of Indianapolis
billb@ohdindy.com
Bill Benefiel
NCPS,NCSD
Manager of Information Systems
Overhead Door Company of Indianapolis
billb@ohdindy.com
Comments
I reccomend putting the file on a network drive and getting the filespec from one or more fields on some table in Navision (or from a text variable in the codeunit or other object itself.)
Having said that, I am not sure why your code doesn't work. The template file is NOT being loaded before the problem line: all you did there was load the filespec into a text variable. My guess would be that the filespec is incorrect, and the best way to test for a correct filespec is to use a file variable, assign the appropriate filespec, and then see if Navision can open the file.
Tim Horrigan, NCSD
<Horrigan@AOL.com>
Currently in search of new employment!
Certified as a Solution Developer and an HR/Payroll Specialist!
<Horrigan@AOL.com>
Currently in search of new employment!
Certified as a Solution Developer and an HR/Payroll Specialist!
Having said that, your statement listed below was not clear for me. When I make the application visible IT DOES LOAD THE CORRECT document. The problem must exist elsewhere. By the way I am running Financials 2.6 and Office 97.
The template file is NOT being loaded before the problem line: all you did there was load the filespec into a text variable. My guess would be that the filespec is incorrect, and the best way to test for a correct filespec is to use a file variable, assign the appropriate filespec, and then see if Navision can open the file.
Bill Benefiel
Manager of Information Systems
Overhead Door Company of Indianapolis
billb@ohdindy.com
[This message has been edited by wbenefiel (edited 04-05-2001).]
NCPS,NCSD
Manager of Information Systems
Overhead Door Company of Indianapolis
billb@ohdindy.com
wdDoc := wdApp.Documents.AddOld(...);
and it will work.
Best regards
HaZe
Best regards
.::HaZe::.
I am using Navision 2.6B and Office '97. I also have Visual Studio loaded on my machine.
Thanks.
Bill Benefiel
NCPS,NCSD,NCDS
Manager of Information Systems
Overhead Door Company of Indianapolis
billb@ohdindy.com
NCPS,NCSD
Manager of Information Systems
Overhead Door Company of Indianapolis
billb@ohdindy.com