Dot Net Variables in NAS

Dear Sir,

I'm facing a problem with the DotNet variable in NAS Environment (NAV 2016). I have declared all the DotNet variables in a Codeunit to convert the WORDLAYOUT of a Report output into a HTML file. After that the Codeunit send the same HTML file in a email body.

It's working fine when I execute the Codeunit manually. It creates WORD file, converts it into HTML and then send the same HTML in the body of the email. During manual execution I have to declare all the DotNet variable as RunOnClient YES.

And in NAS Environment I have declared the same DotNet variables as RunOnClient No .
The piece of the Custom Code is as follows....

WordApplication :=WordApplication.ApplicationClass;
WordDocument :=WordHelper.CallOpen(WordApplication,FileName,FALSE,TRUE);
FileName2 := TEMPORARYPATH + DELCHR(FORMAT(CURRENTDATETIME),'=','\/:*?"<>| ');
WordHelper.CallSaveAsFormat(WordDocument,FileName2,WordSaveFormat.wdFormatHTML);


The NAS has found null value in the first parameter of "CallSaveAsFormat" function and hence it gives the following error message.

Microsoft Dynamics NAV

A call to Microsoft.Dynamics.Nav.Integration.Office.Word.WordHelper.CallSaveAsFormat failed with this message: Value cannot be null.
Parameter name: document

OK

I can't find the reason why it is doing so in NAS. If you have any idea about the same please reply.
Thank you,

Subrata Bauri

Related
Recommended