Jump to content

Excel 2010 does not start on windows 2008 server


Recommended Posts

Hello, I have a problem when starting Excel 2010 on a windows 2008 SR2 server.

In my program i use the following statements:

$original="f:\apps\ams\original.xls"

$workfile="f:\apps\ams\workfile.xls"

FileCopy($original,$workfile,1)

Sleep(1000)

_FileWriteLog($logfile,"file copied")

$oExceldos = _ExcelBookOpen($workfile,1)

Sleep(1000)

_FileWriteLog($logfile,"excel active")

When i login on the server as a user everything works fine and in the logfile there are the two lines

(file copied and excel active)

When i let the taskscheduler or a service start the program (logged in as administrator) i only get the first line (file copied) and not the second line.

Starting the taskmanager shows me that there is a Excel proces active, but it is only about 8.500 k large.

(and it should be at least 20.000 k, because the sheet is already filled with data)

Trying to run it as a local system account wich can show the screens on the desktop, also doesn't work.

Perhaps it isn't possible to start excel from the taskscheduler or service because they have no profile on the server. (A user normally has one).

Does anyone know a soluton for this problem?

Link to comment
Share on other sites

No, manually everything works as it should be. Only when the script is executed from the taskscheduler or starts as a service Excel won't start

It seems Excel is preparing something or wants to write something in the profile. And the taskscheduler or servicemanager have no profile.

So I'm looking for something in which I can tell Excel to act like e.g administrator or another user. The command RUNAS doesn't work, because it only applies for the autoit script and not for the Excel (_ExcelBookOpen)

Link to comment
Share on other sites

Excel is active in the taskmanager, but with very littel kb (about 8.5 kb). So it is waiting for something and i think it wants to write something in the "user" profile.

Which doesn't exits!!! Pfff Windows....

Eventually I rewrited my script, using .dat files to store the data and when I want to see the Graphics imported them into Excel.

So far this works, but I'm not pleased. (Learned a bit about writing and importing data from .dat files and that is at least positive)

Unless someone knows a solution to the problem, I think we should close the topic.

Thanks for replying, until the next time!

Link to comment
Share on other sites

  • 8 months later...

The Excel works fine from user service under Local System Account. But.. several conditions needed:

1) First, in the Windows 2008 you must manually(!) create 2 folders:

  • C:Windowssystem32configsystemprofiledesktop
  • C:WindowsSysWow64configsystemprofiledesktop
2) The prevision post also is right "..first time start..". In the first time for new user Excel ask the user credentials (name and first letters for surname) but under service Excel is invisble and this window freeze Excel. User credentials can be disabled in EXcel options or you can do it manually - run you service with "desktop interaction" option enabled, the Windows will show system alert after launching EXcel, switch to Excel window and enter user credentials manually. After then restart you service with working options(disable desktop interaction).

3) To make the code more stable in service mode not use the CreateObject and Run to launch EXcel. Use following approach: start Excel via ShellExecuteEx; connect to Application object using GetActiveObject. Now you can use COM interfaces safely.

This article explains several things about this problem.

Best regards.

Edited by NikosRubin
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...