How to open workbook by filename without displaying Excel window?
c#, excel, office-interop
Solution
Try to open your file from new Application object:
var excel = new Excel.Application();
var workbook = excel.Workbooks.Open(filename);
It is possible, that you have excel instance already running, then new workbook becomes visible as well.
EDIT: In case if you need to get a reference for a workbook that is already opened you can get it by name:
Excel.Workbook currentWrkBook = Excel.Application.Workbooks[fileName];
Problem
I get `currentWrkBook` by `fileName` with the code below: ``` using Excel = Microsoft.Office.Interop.Excel; ... Excel.Workbook currentWrkBook = Excel.Application.Workbooks.Open(fileName); ... ``` Result get OK (when run to the statement above, the fileName`[D:/DataProject/Resources.xlsm]` is open): Now, I would like get currentWrkBook by fileName without open file. That is possible? Any tips on these will be great help. Thanks in advance.