使用工作表填充的DataGridView &其可见性状态:
我为我的Excel加载项设置了一个自定义任务窗格,其中包含了从打开的DataGridView中填充的WorkBook:
,
,
截取工作表可见性从Addin更改?
我有一些操作/任务发生在Excel工作簿中,用户所做的这些操作/任务可以根据s/他在做什么来显示/隐藏工作表。所以,
我们非常感谢你对此提出的意见/建议。请随时通知我,如果您需要进一步的信息,我将很高兴更新这篇文章或回复您的意见。
发布于 2020-04-13 17:06:39
最好是直接从Excel中调用外接程序:
using System.Runtime.InteropServices;
using Microsoft.Office.Interop.Excel;
namespace YourSolution
{
[ComVisible(true)]
public interface IAddInUtilities
{
//You have to implement this
void YourFunctionToCall();
}
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
public class AddInUtilities : IAddInUtilities
{
//Implemntation: Call this from your Excel
public void YourFunctionToCall()
{
//The Operation here ...
}
}
}然后,在Excel中,使用以下Sub:
Public Sub FunctionCallableInVBA()
Dim addIn As COMAddIn
Dim automationObject As Object
Set addIn = Application.COMAddIns("YourSolution")
Set automationObject = addIn.Object
'Call the Function your shared on the COM
automationObject.YourFunctionToCall()
Set addIn = Nothing
Set automationObject = Nothing
End Sub这样可以解决您的问题,并避免您拼命地搜索现有的隐藏/取消隐藏事件。
https://stackoverflow.com/questions/61108484
复制相似问题