Tag: 接口

用IF公式编程方式填充Excel单元不起作用

我正在尝试通过COM Interop编程方式填充Excel 2010单元格,并使用表示IF公式的string。 下面的代码行工作得很好,它在Excel中parsing为值4: .Range("C10").Value = "=2+2" 但是当我通过一个IF-Formula(as String)… .Range("C11").Value = "=IF(1+1=2;2;0)" …我碰到一个COMException ,说: Exception from HRESULT: 0x800A03EC 。 如果我直接在Excel中input相同的IF-公式,它将被正确parsing。 谢谢你的帮助! 克里斯

Excel RTD COM服务器 – 无法将UpdateEvent(类)转换为IRTDUpdateEvent(接口)

此问题与Kenny Kerr在“Excel RTD服务器:C#接口”中的博客文章相关,可在此处find该博客文章,该文章允许您构buildExcel RTD服务器,而不包含对任何特定Exceltypes库的引用; 不得不包括一个引用,使您的RTD服务器Excel版本特定(转发兼容,但不是向后兼容,我相信)。 对Exceltypes库不具有任何依赖性可简化RTD到具有不同版本的Excel(XP,2003,2007和2010)的计算机的部署。 现在,没有RTD引用特定的Exceltypes库来获取接口IRtdServer和IRTDUpdateEvent是非常好的。 但是我有一个时间使得Kenny的build议工作的魔鬼。 这是我所做的: 1) Added IRtdServer.cs and IRTDUpdateEvent.cs to my RTD project and put the interface definitions from your blog into those files (not changing the GUIDs). 2) Removed any reference to an Excel type library. 3) Build and regasm OK. 我在VBA和VBScript中有很小的testing工具,通过模拟Excel对RTD的调用来testing我的MyRTD.dll RTD服务器。 以下是相关的代码片段: 第一个VBA: Const RTDProgID As String […]

从Excel调用R-UDF

我想要在Excel中调用R函数并将结果返回给Excel中的函数(采用Excel-Arguments)。 RExcel似乎不在CRAN(已经),我还没有find一个替代scheme。 有谁知道一个办法来实现这一目标? 一个限制是即使没有Windows Vista的pipe理员权限,该解决scheme也应该可以工作。 编辑:感谢您的评论。 我们已经尝试过R.Net,但收效甚微。 我们去了: using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Text; using ExcelDna.Integration; using System.Windows.Forms; using RDotNet; using RDotNet.NativeLibrary; public static class MyFunctions { [ExcelFunction(Description = "Test R connection")] public static double MyRTest(double x) { var envPath = Environment.GetEnvironmentVariable("PATH"); var rBinPath = @"D:\Programme\R\R-2.15.1\bin\i386"; Environment.SetEnvironmentVariable("PATH", envPath + Path.PathSeparator + […]

在VBA中实现接口的类模块中的其他方法

我为Microsoft Excel 2010编写一个VBAmacros。 在我的项目中的一些模块真的会哭出来的子类,但我已经明白,不支持inheritance。 知道了,我走了很艰难的路,并在每个模块中使用一个接口再次实现了所有的方法。 但是,现在我体验到只有一个模块(但不在接口中)发生的方法会引发exception: 未find方法或数据成员! 我不完全确定,但我有这样的感觉,这是与界面有关。 所以我想知道以下几点: 在VBA模块中实现一个接口时,是否仍然可以为这个模块编写额外的公共子集? 如果这是不可能的,那么将某个function附加到实现接口的模块的正确模式是什么?