I have code in C# like this.
xlWorkBook = xlApp.Workbooks.Open("data.xls", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
I have data.xls file where .exe are located.
When I compile and then run .exe, I’m receiving error that data.xls could not be found.
What I do wrong?
If your xls will always be in the same location as your .exe, you can use this to get a path that won’t be hardcoded to the build directory: