I'm getting the error:
Microsoft Excel cannot access the file '..\services\Calculator.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.
Any ideas?
I tried this, but does not seem to work 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