I am attemtping to convert some vba code to C#. I'm making pretty good progress, but the bottom two lines in my code are giving me errors. What do I need to change so that this code will function as desired?
Application oApp = new Application();
Workbook wb = oApp.Workbooks.Open("C:\\Test\\Test Data.xlsx");
var firstSheet = (_Worksheet) wb.ActiveSheet;
Range last = firstSheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell, Type.Missing);
Range range = firstSheet.get_Range("A1", last);
int lastRow = last.Row;
int lastColumn = last.Column;
long outputColumn;
long tempCol1;
long tempCol2;
string dataVal;
string letterVal;
string decodedVal;
outputColumn = lastColumn + 1;
tempCol1 = lastColumn + 2;
tempCol2 = lastColumn + 3;
//this gives build errors
Excel.Columns(lastColumn).Copy(Excel.Columns(tempCol1));
Excel.Cells(1, tempCol1).Delete();
EDIT
The build error I get is
The name `Excel` does not exist in the current context