C#Excel插件-获取活动的Excel工作簿 [英] C# Excel Addin - Get the active excel workbook
本文介绍了C#Excel插件-获取活动的Excel工作簿的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写一个Excel Add,它将从数据库中获取数据。我可以在 OnConnection Extensibility.IDTExtensibility2
中将自定义菜单添加到excel中,但是此后Excel对象被销毁,并且无法访问活动工作簿。
I am writing an excel Add which will fetch data from database. I am able to add the custom menu to excel in OnConnection Extensibility.IDTExtensibility2
, but after that the Excel Object is destroyed and I am not able to access the Active Workbook.
如何访问处于活动状态的Excel工作簿?
How to access the excel workbook that is active?
推荐答案
1> (((Microsoft.Office.Interop.Excel.Application)Marshal.GetActiveObject( Excel.Application)。ActiveWorkBook
2>您可以检查我的在此处回答以获取excel应用程序对象的句柄获取excel UDF中的单元格地址
这篇关于C#Excel插件-获取活动的Excel工作簿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文