More C# Automating to Excel

有些话、适合烂在心里 提交于 2019-12-03 21:13:34

You can get an existing instance of Excel using:

Marshal.GetActiveObject("Excel.Application")

This will throw a COMException if there is no instance of Excel running.

One pitfall of automating an instance of Excel that is visible is that your calls may fail because Excel is busy. You may need to implement IMessageFilter to avoid this problem.

As for accessing a closed workbook by path - you need to open the workbook:

oXL.Workbooks.Open(...)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!