以下のコードでExcelファイルにアクセスしようとしています:
Microsoft.Office.Interop.Excel.Application ObjExcel
= new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook book;
Microsoft.Office.Interop.Excel.Worksheet sheet;
Excel.Range range1 = null, range2 = null;
CultureInfo ci = new CultureInfo("en-US");
Thread thisThread = Thread.CurrentThread;
thisThread.CurrentCulture = new CultureInfo("en-US");
book = ObjExcel.Workbooks.Open(LinguisticInstructionsFileName);
book 変数の最後の行の内容はSystem.__ComObject
while in different app code is working で、 variable has...Excel.WorkbookClass
です。
では、この奇妙な振る舞いの理由は何なのか、お聞きしたいと思います。追加の Missing.Value 引数を使用して Workbooks.Open を呼び出そうとしましたが、結果は同じでした。