2013-10-02 3 views
0

나는 오류를 받고 있어요? 열기 엑셀 파일 문제

나는 이것을 시도,하지만 난 나를 위해 일한 해결책을 발견 Microsoft Office Excel cannot access the file 'c:\inetpub\wwwroot\Timesheet\App_Data\Template.xlsx'

Dim xlApp As Application = New Application 
Dim xlWB As Workbook 
xlWB = xlApp.Workbooks.Open(Server.MapPath("~") + "\services\Calculator.xlsx", 2, True) 

Dim xlSheet As Worksheet = xlWB.Sheets("input output") 

xlSheet.Cells(7, 8).value = drpTrades.SelectedValue 
xlSheet.Cells(12, 8).value = Convert.ToDecimal(txtIncome.Text) 
xlSheet.Cells(9, 8).value = loan.Text 

Dim xlRebate As Decimal = xlSheet.Cells(18, 8).value 
If xlRebate < 0 Then lblRebate.ForeColor = System.Drawing.Color.Red 
lblRebate.Text = "£" + Math.Round(xlRebate, 2).ToString 

xlWB.Close(False) 
xlApp.Quit() 
ReleaseComObject(xlApp) 
xlApp = Nothing 
+0

절대 경로를 시도하십시오 (일시적). 현재 작업 디렉토리는 과학보다 예술입니다. – Bathsheba

+0

가끔 "Excel"응용 프로그램을 닫는 데 문제가 있습니다. ASP에서, 이것은 진짜 나쁜 얻을 수 있습니다. 서버에 접속하여 작업 관리자가 실행 중인지 확인하십시오. 또한 서버에 로그인되어있는 동안 파일을 열 수 있는지 확인하십시오. 무슨 일이 일어나고 있는지 알 수 있습니다. – Steve

+0

경로가 올바른 것처럼 보입니다. Yeap이 파일을 열 수 있음 –

답변

1

작동하지 않습니다. 구성 요소 서비스 (제어판> 관리 도구 아래에 있음) 컴퓨터> 내 컴퓨터> DCom Config> Microsoft Excel 응용 프로그램, 속성, ID 탭을 선택하면 사용자를 선택하십시오.

새로운 로컬 계정을 만들어 실행했으며 모든 기능이 작동했습니다.