M
Mark B
Bit of an odd one, but I cannot figure out why the Workbooks.Open command
produces an exception (see below) only when the command is run from a windows
service running on Vista.
So far I have discovered the following:
1. Its not version specific to Exel, I get the same result on version 2003
and 2007.
2. I can "see" and fully access the workbook from the service. I've done a
few tests involving using Shell to launch Excel with the workbook as well as
creating new files from the service, which both worked ok.
3. Ive tried late binding to the Excel application and invoking the Open
method, same exception.
4. I've verified that my code is working ok in a console app.
From looking up on the internet the exception is quite a generic one, as in
"something hasn't worked, i'm failing now", but heres the exception:
System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Office
Excel cannot access the file 'C:\TestExcelService\Test_Excel.xlsx'. There are
several possible reasons: • The file name or path does not exist. • The file
is being used by another program. • The workbook you are trying to save has
the same name as a currently open workbook. at
Microsoft.Office.Interop.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,
Object Local, Object CorruptLoad)
If anybody has any ideas on how to fix this I'd really appreciate it.
Thanks
Mark
produces an exception (see below) only when the command is run from a windows
service running on Vista.
So far I have discovered the following:
1. Its not version specific to Exel, I get the same result on version 2003
and 2007.
2. I can "see" and fully access the workbook from the service. I've done a
few tests involving using Shell to launch Excel with the workbook as well as
creating new files from the service, which both worked ok.
3. Ive tried late binding to the Excel application and invoking the Open
method, same exception.
4. I've verified that my code is working ok in a console app.
From looking up on the internet the exception is quite a generic one, as in
"something hasn't worked, i'm failing now", but heres the exception:
System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Office
Excel cannot access the file 'C:\TestExcelService\Test_Excel.xlsx'. There are
several possible reasons: • The file name or path does not exist. • The file
is being used by another program. • The workbook you are trying to save has
the same name as a currently open workbook. at
Microsoft.Office.Interop.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,
Object Local, Object CorruptLoad)
If anybody has any ideas on how to fix this I'd really appreciate it.
Thanks
Mark