Jump to content
Sign in to follow this  
albertmaathuis

Excel 2010 does not start on windows 2008 server

Recommended Posts

albertmaathuis

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
Juvigy

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

Share this post


Link to post
Share on other sites
albertmaathuis

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
Tripredacus

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
albertmaathuis

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
Juvigy

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
NikosRubin

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  

  • Similar Content

    • Skeletor
      By Skeletor
      Hi Guys,
      Can anyone point me in the right direction. I'm trying to accomplished conditional formatting with arrows, but the code I have is wrong... 
      .Range("=$A3:$A4000").FormatConditions.Add = (xlCellValue, xlGreater, "=$A:$A") .IconSet(xl3Arrows) ;ActiveWorkbook.iconsets I also tried it like this:
      .Range("=$A3:$A4000").FormatConditions _ .Add(xlCellValue, xlGreater, "=$A:$A") .IconSet(xl3Arrows) ;ActiveWorkbook.iconsets  
    • Skeletor
      By Skeletor
      Hi Guys,
      How would you use _Excel_FilterSet to filter the excel sheet from largest number to smallest number?
      _Excel_FilterSet($oWorkbook, "Sheet1", "A2:I2", 1, ">20", 1, "<40") ; OR _Excel_FilterSet($oWorkbook, "Sheet1", "A2:I2", 1, ">", 1, "<") Excel Sheet attached. Trying to filter on the last column "I2"
      Inventory.xlsx
    • Skeletor
      By Skeletor
      Hi All,
      Has anyone come across this before?
      Code below:
      $SheetList = _Excel_SheetList($oWorkbook) _FileWriteFromArray("C:\" & $SheetListOutput, $SheetList, 1) Result:
      ResultABC| ResultDEF| ResultGHI| ResultJKL| ResultMNO| It created these "|" vertical bars?
    • Skeletor
      By Skeletor
      Hi All,

      I would like to know how you would take a FileLineRead and insert it into an array which then inserts it into Excel?
      One thing to know is the files content is broken up, so I only use half of the content within $FileRead1.
      So its imperative that the $value1, $value2, etc variables be used. 
      Code below:
      $FileRead1 = FileReadLine("C:\temp\sample.txt",1) For $count = 1 To _FileCountLines($FileRead1) Step 1 $string = FileReadLine($FileRead1, $count) $input = StringSplit($string, ",", 1) $value1 = $input[1] $value2 = $input[2] $value3 = $input[3] $value4 = $input[4] _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value1, "A1") _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value2, "B1") _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value3, "C1") _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value4, "D1") Next  
    • AnonymousX
      By AnonymousX
      Hello,
      I'm trying to write a script that moves copies excel cells into an array. I'll than manipulate the values and send array into another program. 
      I don't want range to be specific to a workbook, or sheet, or set of cells.
      I want user to be able to highlight desired cells and to copy either normally ("Ctrl+C") or by a hotkey ("Alt+C"). 
      Could someone help me with this?
      Thank you,
      I've tried to write the framework: (edited)
      #include <MsgBoxConstants.au3> #include <Array.au3> #include <Excel.au3> HotKeySet("!v", "Pastedata") While True Sleep(1000) WEnd func Makearray() local $bArray ;User has cells already copied ;Convert clipboard into an array ;I don;t know how excel stores data to clipboard so don;t know how to bring it into array _Arraydisplay($bArray) MsgBox(0,0,$bArray) return $bArray endfunc func Pastedata() Local $aArray MsgBox(0,0,"wait",1) ;make array based on assumption user has already copied a range to clipboard $aArray = Makearray() ;paste code ;don;t worry about this I got the rest endfunc  
×