本文介绍了Can Range.Value2& Range.Formula在C#中有不同的值,而不是VBA?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个 UDF ,就像 GetPath(参数),其中参数可以是单元格引用像B1,或一个字符串
根据输入, GetPath web服务获取输入路径
eg单元格的公式 A1 = GetPath(B1),单元格 B1 有一些字符串,该函数应该返回路径并放置在单元格A1中,即A1的路径为Value2

I want to create a UDF which is like GetPath(parameter), where parameter can be a cell reference like "B1", or a string what the GetPath does, based on input, it will call web service to get path for input e.g. formula of cell A1=GetPath(B1), cell B1 has some string, the function should return path and put it in cell A1, i.e. "Value2" of A1 should be path of B1.

现在在C#中,当我执行sth FormulaCell.Value2 = path 时,其公式也会更改
但我想要Formula& Value2不同。

Now in C#, when I did sth FormulaCell.Value2 = path, its formula changes, toobut I want "Formula" & "Value2" to be different.

我知道这是可能在VBA,但我使用C#。

I know this is possible in VBA, but I am using C#.

任何人都知道如何完成这个?

Anyone knows how to accomplish this?

谢谢

我googled,谷歌搜索,仍然找不到解决方案。
这听起来像一个基本功能,但在C#中是不可能的。至少这就是我通过研究得到的。我确信你们中有些人以前遇到过同样的问题,只是想知道你如何工作?

I googled, googled and still not found a solution. This sounds like a basic feature but impossible in C#. at least that's what I got through research. I am sure some of you have encountered the same issue before, just wonder how you work it out?

如果这样工作,我将尝试在VB.NET中我将在C#中引用它。如果有任何人在VB.NET中知道,请同时发布。谢谢

I am going to try this in VB.NET if that works then I will reference it in C#. If anyone knows in VB.NET, pls also post. thanks

推荐答案

我的插件是COM AddIn,不可能有range.value2与range.formula不同的是
否它是C#或VB.NET。

My addin was COM AddIn which is not possible to have range.value2 different from range.formulano matter it is C# or VB.NET.

这可以使用VBA,.NET中的Automation AddIn或xll addin完成。
对于xll addin,您可以使用C / C ++编写,也可以使用现有工具,如ExcelDNA,managedXLL,XLW等。

This can be done using VBA, Automation AddIn in .NET, or xll addin. For xll addin, you can either write in C/C++, or use existing tools like ExcelDNA, managedXLL, XLW, etc.

这篇关于Can Range.Value2& Range.Formula在C#中有不同的值,而不是VBA?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 23:42