Search code examples
delphims-wordautomationadministratoroffice-2010

Word automation does only work for administrator, or with a delay after creating word.application


We have a program made in Borland Delphi that uses Word automation to create documents. On an installation (terminal server) we are only able to get the Word automation to work when running as local administrator.
When runnnig as anoter user we get an error message "Opdracht mislukt -2146824090" (its dutch version of Office), wich I guess is translated to "Operation failed" or "Command failed".

The user has read/write access to the folder where the program try to put the new document.

Office 2010
64bits Windows server 2008 R2 standard

The applicaion is 32bit windows application.

If I add a delay (500ms) after the word.application is created, everything works as normall.

WordApp   := CreateOleObject('Word.Application');
sleep(500);
Doc := WordApp.documents.Open(sFile,EmptyParam,true);

Anybody knows why the CreateOleObject command now returns before the Word application can be used?


Solution

  • The administrator account working wihtout delay, seems not to have anything with rights to do, but that Word happens to start much faster with this account than the normal domain user accounts.

    I can live with the delay workaround, but if anyone knows a better way please let me know.