Sign in to follow this  
Followers 0
albertmaathuis

Excel 2010 does not start on windows 2008 server

7 posts in this topic

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?

Share this post


Link to post
Share on other sites



Login as administrator and try the script manually from SCITE. Do you get errors?

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

What account are you running the task or service under? Some accounts in Windows are not allowed to interact with the user ie, open Excel. I'd check with Task Manager to see if excel.exe is actually running or not. It may just be a session 0 isolation issue.

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

I think excel/MS office needed "first time start" , so issue would be resolved if you log in to windows with that acount and start office/excel/

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • LoneWolf_2106
      By LoneWolf_2106
      Hi all,
      i have an empty csv file, i have a non formatted text file.
      What do i want to do?
      I want to automate the process "get external data" in Excel, i want to import the data from the text file and basically create a csv file with a specific character encoding.
      Is it possible with AutoIT?
       
    • breakbadsp
      By breakbadsp
      I  want to create a excel file from my script if it does not exist.
      _ExcelBookOpen throws error=2 if file does not exist, after this error i want to create new file at this point.
      can i use _FileCreate()?
      _Logger($sLogPath, "{INFO}------: Opening Excel File: " & $sExcelPath& "") While 1 Local $oExcelTestResult = _ExcelBookOpen($sExcelPath) If @error = 2 Then If not _FileCreate($sResExcelPath) Then MsgBox(0, "Error", "Error In Opening REsult Excel File: Error: " & String(@error)) _Logger($sLogPath, "{ERROR}------: Result Excel File does not exist.. tried to create new but :ERROR : " & String(@error) & "") ExitLoop Else _Logger($sLogPath, "{INFO}------: Result Excel File does not exist.. **Created New**: ") EndIf Else ExitLoop EndIf WEnd  
    • LoneWolf_2106
      By LoneWolf_2106
      Hi everybody,
      i have to store an entire row of a Excel workbook into an array.  The row index is stored in a variable.
      How can i do it?
      Thanks in advance for your support.
    • LoneWolf_2106
      By LoneWolf_2106
      Hi everybody,
      i have to write a value into an excel column.
      I know where it starts from, but i don't know what the end is, last non-empty cell.
      How can i get the number of last non-empty cell?
      Thanks in advance.
      Regards 
    • Nareshm
      By Nareshm
      Hi All,
      I have excel file like this
      and i want to cut cell/text from excel to other software.

       
      I have to cut the cell of B column one by one and past into other software
      If Winexists("No Data Found")
      then restore cuted cell and goto next/down side cell
      How to do it ?