如何在不涉及VBA代码的情况下通过C#使用Application.OnKey? [英] how to use Application.OnKey by C# without involving VBA code?

查看:98
本文介绍了如何在不涉及VBA代码的情况下通过C#使用Application.OnKey?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在excel模板(.xlt)中使用UDF我曾经使用过Application.OnKey("^v","MyFunction");我想在用户将单元格粘贴到excel中时使用单独的函数,即MyFuction,但是当我在thisworkbook.cs中定义函数时不会工作...

I want to use the UDF in excel template(.xlt) I have used Application.OnKey("^v","MyFunction");i want to use separate function when user paste the the cell in excel i.e. MyFuction but when i defined function with in the thisworkbook.cs i wont work...

先谢谢了.

推荐答案

这不起作用.您需要在VBA中定义该函数,然后从该VBA函数中调用.NET方法,如最后所述:

This won't work. You need to define the function in VBA and call you .NET method from that VBA function, like explained here at the end: http://msdn.microsoft.com/en-us/magazine/cc163373.aspx

这篇关于如何在不涉及VBA代码的情况下通过C#使用Application.OnKey?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆