MailMerge from NAS - The type 'Automation' was not defined

RnRRnR Member Posts: 21
Have set up a job in Job Queue which is started by the NAS. Everything works well on the server if I start the job manually from the classic client. Correct Office version is installed and I have quadruppelchecked the DataTypes and Subtypes.

In CodeUnit 5054 (WordManagement) this line "wrdDoc := wrdApp.Documents.Open(MainFileName);" is giving me the following error: The type 'Automation' was not defined for the function.

Have changed the location of the file, tested with hardcoded paths, checked that the wrdDoc is created, ensured the NAS user can access the folders and files etc etc.

For me it seems like there is something with users and rights running the automation 'Microsoft Word 14.0 Object Library'.Application, but can't figure out what's wrong.

Anything to do with Office 2010?

Any hints?

Cheers
r.

Comments

  • ProcatProcat Member Posts: 31
    Yes, try installing Word (or Office) on the server, should help.
  • RnRRnR Member Posts: 21
    Office 2010 is installed on both client and server..
  • ta5ta5 Member Posts: 1,164
    I'm not sure, maybe it could be a license problem?
    Thomas
  • vaprogvaprog Member Posts: 1,139
    RnR wrote:
    Everything works well on the server if I start the job manually from the classic client.
    Did you do this with the same user the NAS uses?
    Also try running nas as an application rather than a service. What happens?
  • RnRRnR Member Posts: 21
    yes, same user, language, fin.flf..

    Hmm, can you point me in the right direction about running the NAS as an application and not as a service?
  • vaprogvaprog Member Posts: 1,139
    e.g.
    nas.exe appservername=NAS,servername=localhost,nettype=TCP,company="My Company",startupparameter=OSYNCH,debug
    
    Parameters are documentet in Installation & System Management: Application Server for Microsoft Dynamics™ NAV (w1w1atas.pdf)
    With the debug parameter and a developper's license, the debugger will be active and Break on Triggers will be activated. You can set breakpoints and let it run or just let it run to catch the code line that raises the error.
    You don't have to use that parameter though, since the purpose of running nas ineractively here is that the automation server can show prompts and messages. MS Office is notorious for this. But since you run the code from the same user from the client, you should have caught these already. But checking it out does not hurt...
  • RnRRnR Member Posts: 21
    Thanks a lot vaprog!

    By running the NAS as an application in debug mode helped me fix a few problems about temp file paths.

    At the end, it runs and everything is fine. Shut down the NAS application and started the service NAS, and the same error occurs: "..Automation is not defined for the function".

    When I run the NAS as an application I'm logged on to the server with the same domain user as the service NAS uses.

    Running code in debug mode can run smooth when it comes to code reading/writing from/to files, but running the same code in normal mode can generate some errors since the file wasn't properly saved before the next line of code was run. So i ran the NAS as an application without debug mode, and that also went fine :)

    Under which user is the application NAS running? Can I set the user?
  • vaprogvaprog Member Posts: 1,139
    RnR wrote:
    When I run the NAS as an application I'm logged on to the server with the same domain user as the service NAS uses.
    RnR wrote:
    Under which user is the application NAS running? Can I set the user?
    Unless you tell the system to do differently, any new process/application runs under the same user as it's parent process. So unless you use runas or anything similar to this NAS as an application runs with the user you logged into windows.
    You can check in the task manager. User name column is shown by default.
  • Benno67Benno67 Member Posts: 39
    Hi there,

    Did you ever solved the problem? I do have the same problem (also on trying to use mailmerge in the NAS).
    The cu works fine when running on a client, works fine when I start the NAS on the command prompt, but fails on opening an (previous saved) XML file when the NAS is started as a service.
    More weird: it works perfectly in our development environment!, with the NAS started as a service?

    The only difference between development and production is the server (2003 Server SP2 resp 2008 Server SP2)

    Of cource, the solution works with the NAS run on the command prompt, but we donot like that solution

    Benno
  • GoMaDGoMaD Member Posts: 313
    you answered your question in this thread in another thread ! ;)

    http://www.mibuso.com/forum/viewtopic.php?f=23&t=51723&hilit=word+active
    Now, let's see what we can see.
    ...
    Everybody on-line.
    ...
    Looking good!
Sign In or Register to comment.