tags:

views:

41

answers:

1

I have create Office Excel application in my machine(XP). and i have placed the application in windows server 2008 giving the following error.

Microsoft Office Excel cannot access the file '\server\Input.xls'. 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.

both client and server systems installed office 2007 and added reference microsoftexcellibrary 12.0

created assembly for the application and calling the code from the form.

A: 

I would make sure no Excel processes are running on the machine before you run this application, that should cover the last point.

The first point looks the most likely issue, the path looks like a partial path or an incorrect UNC path. Try putting the full path to the spreadsheet 'C:\server\input.xls' and see if that works.

To stop the middle point, in the workbook.open command you can specify to open as read-only, this will make sure the application can red the file even if it is locked open by another user.

Hope this helps

DJIDave
I have tested the same app in local machine it is working. when i placed the same logic in the server it is giving error.
Nag
It could be that the spreadsheet on the server is open by someone else (as I don't know the layout of your systems), so it would work happly with your local version but fail on the server. It is also possible for you to have another version of the spreadsheet on your local system that in relation to the exe is discoverable, but there is no spreadsheet in the relative path on the server.
DJIDave
I am using shared path from the other server.
Nag
the path is \\<Server>\Input.xls same when i executed on machine and server. but it is failing in server only. excel = New Excel.Application wBook = excel.Workbooks.Add("\\<Server>\Input.xls") even wBook.SaveAs("\\<Server>\TestJobCompare.xlsm", 52) is failing if i remove code of copying the Input.xls. Exception from HRESULT: 0x800A03ECi suspect this is relating to permissions or windowsserver 2008.
Nag