Thread: Open an excel file from a windows service under Windows Vista

  1. #1
    Registered User
    Join Date
    Jun 2007

    Open an excel file from a windows service under Windows Vista


    I create a windows service. In its start method I try to open an excel file. I use the following code:

    Excel.Application excelApplication = new Excel.ApplicationClass();
    object _missingParam = Missing.Value;
    Excel.Workbook _excelWorkbook = excelApplication.Workbooks.Open(filename,0, 0, _missingParam, _missingParam, _missingParam, _missingParam, _missingParam, _missingParam, _missingParam, _missingParam, _missingParam, _missingParam);

    On windows XP when I start the service this works fine.

    But on windows Vista I get the following error:
    System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC.
    at Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru)
    at SPARTAServ.SPARTAService.OnStart(String[] args) in e:\work\spartaserv\spartaservice.cs:line 243

    Please help. Thanks.

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    With your Visual Studio should come an error lookup utility. Put the HRESULT value in there and tell us what it means.

    Also, Google gives some results that might help:
    Last edited by CornedBee; 06-05-2007 at 04:00 AM.
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 05-27-2009, 12:46 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  3. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  4. Another windows service question... starting/stopping
    By BrianK in forum Windows Programming
    Replies: 1
    Last Post: 03-20-2003, 12:22 AM
  5. Invoking MSWord
    By Donn in forum C Programming
    Replies: 21
    Last Post: 09-08-2001, 04:08 PM