开发者

Marshal.GetActiveObject() problem

开发者 https://www.devze.com 2023-01-07 02:53 出处:网络
I am using Microsoft.Office.Interop.Excel.Application oExcelApp = (Microsoft.Office.Interop.Excel.Application)Marshal.GetActiveObject开发者_StackOverflow(\"Excel.Application\");

I am using

Microsoft.Office.Interop.Excel.Application oExcelApp = 
                     (Microsoft.Office.Interop.Excel.Application)Marshal.GetActiveObject开发者_StackOverflow("Excel.Application");

in my project. It gives me an error when there is no Excel file open at the moment. How can I check to see if there is no Excel file running?


Here is approach of using Marshal.GetActiveObject and how to handle situation if object not found. Hope this will help.

0

精彩评论

暂无评论...
验证码 换一张
取 消