使用c#你不能用c#做什么

时间:2021-04-06 21:08:51

I ve heard things like you cannot manipulate tables in C# but can through VBA.

我听说你不能操纵C#中的表,但可以通过VBA。

Does any one know what can be done via VBA which cannot be done via C# PIA?

有没有人知道通过VBA无法通过C#PIA完成什么?

4 个解决方案

#1


3  

One thing I remember while working on a Excel addin was that the OnAction method of pictures/shapes added on a worksheet will not call into the C# addin which seems like a limitation. You can set the OnAction to a VBA macro only. This might not be directly related to your question on the differences in C# and VBA but it just crossed my mind when I saw the questions.

我在处理Excel插件时记得的一件事是,在工作表上添加的图片/形状的OnAction方法不会调用C#addin,这似乎是一种限制。您只能将OnAction设置为VBA宏。这可能与您关于C#和VBA差异的问题没有直接关系,但在我看到这些问题时,我只是想到了这一点。

#2


1  

Fundamentally, there is no real difference. You can do pretty much anything in either environment, especially if you're talking about VB.net and C# - they are more or less different syntaxes that target the same libraries and platforms.

从根本上说,没有真正的区别。你可以在任何一种环境中做任何事情,特别是如果你在谈论VB.net和C# - 它们或多或少都是针对相同库和平台的不同语法。

There are some syntactical differences where certain features of one language do not have direct equivalents in the other, but as long as you have a few basic elements you can write code to achieve the same ends in both.

有一些语法上的差异,其中一种语言的某些特征在另一种语言中没有直接的等价物,但只要你有一些基本元素,你就可以编写代码来实现两者的相同目的。

In some programs you can use VB script (which is a variant of VB) for macros, and in those cases C# can't be used as a direct replacement. But that is a limitation of the host programs, not of VB/C# per se.

在某些程序中,您可以使用VB脚本(这是VB的变体)用于宏,在这些情况下,C#不能用作直接替换。但这是主机程序的限制,而不是VB / C#本身。

edit: You've changed the question completely now, so this answer is probably no longer relevant.

编辑:你现在完全改变了这个问题,所以这个答案可能已经不再适用了。

#3


1  

You cannot debug a problem as it happens on a user's PC with C# because you will not have Visual Studio installed there. With Excel VBA, you can debug from any PC you run the code on.

您无法使用C#在用户的PC上调试问题,因为您不会在那里安装Visual Studio。使用Excel VBA,您可以从运行代码的任何PC进行调试。

EDIT (response to Anonymous' comment)

编辑(回复匿名'评论)

Whilst you can remotely debug this is not the same, as far as I understand. It requires at least the firewall to be opened up to permit the debug traffic (will likely require some major signoff in big corporates) and you cannot debug and repair an ongoing user problem as it happens. Obviously this can't be done with most programming environments, but it was one of VBA's strengths - well, depending on your point of view, I suppose.

虽然你可以远程调试这是不一样的,据我所知。它至少要求打开防火墙以允许调试流量(可能需要在大公司中进行一些重大签收),并且您无法调试和修复正在发生的用户问题。显然,大多数编程环境都无法做到这一点,但这是VBA的优势之一 - 我想,这取决于你的观点。

#4


0  

i think the most important difference from a business perspective is that with C# you no longer have as many "non programmers" lob managers, etc that can produce code (macros). The process is inherently more formalised.

我认为从业务角度来看,最重要的区别在于,使用C#,您不再拥有可以生成代码(宏)的“非程序员”高管经理等。这个过程本质上更加正式化。

In terms of syntax there are lots of differences... but none that are really an issue in terms of the ability to make use of the object model.

在语法方面存在很多差异......但就利用对象模型的能力而言,没有一个是真正的问题。

Sometimes you will find C# requires a few more lines of code, but in others less. Also you will find that alot of the times where you were required to use System API calls are now redundant.

有时您会发现C#需要更多代码行,但在其他代码中则更少。此外,您会发现很多时候您需要使用System API调用现在是多余的。

#1


3  

One thing I remember while working on a Excel addin was that the OnAction method of pictures/shapes added on a worksheet will not call into the C# addin which seems like a limitation. You can set the OnAction to a VBA macro only. This might not be directly related to your question on the differences in C# and VBA but it just crossed my mind when I saw the questions.

我在处理Excel插件时记得的一件事是,在工作表上添加的图片/形状的OnAction方法不会调用C#addin,这似乎是一种限制。您只能将OnAction设置为VBA宏。这可能与您关于C#和VBA差异的问题没有直接关系,但在我看到这些问题时,我只是想到了这一点。

#2


1  

Fundamentally, there is no real difference. You can do pretty much anything in either environment, especially if you're talking about VB.net and C# - they are more or less different syntaxes that target the same libraries and platforms.

从根本上说,没有真正的区别。你可以在任何一种环境中做任何事情,特别是如果你在谈论VB.net和C# - 它们或多或少都是针对相同库和平台的不同语法。

There are some syntactical differences where certain features of one language do not have direct equivalents in the other, but as long as you have a few basic elements you can write code to achieve the same ends in both.

有一些语法上的差异,其中一种语言的某些特征在另一种语言中没有直接的等价物,但只要你有一些基本元素,你就可以编写代码来实现两者的相同目的。

In some programs you can use VB script (which is a variant of VB) for macros, and in those cases C# can't be used as a direct replacement. But that is a limitation of the host programs, not of VB/C# per se.

在某些程序中,您可以使用VB脚本(这是VB的变体)用于宏,在这些情况下,C#不能用作直接替换。但这是主机程序的限制,而不是VB / C#本身。

edit: You've changed the question completely now, so this answer is probably no longer relevant.

编辑:你现在完全改变了这个问题,所以这个答案可能已经不再适用了。

#3


1  

You cannot debug a problem as it happens on a user's PC with C# because you will not have Visual Studio installed there. With Excel VBA, you can debug from any PC you run the code on.

您无法使用C#在用户的PC上调试问题,因为您不会在那里安装Visual Studio。使用Excel VBA,您可以从运行代码的任何PC进行调试。

EDIT (response to Anonymous' comment)

编辑(回复匿名'评论)

Whilst you can remotely debug this is not the same, as far as I understand. It requires at least the firewall to be opened up to permit the debug traffic (will likely require some major signoff in big corporates) and you cannot debug and repair an ongoing user problem as it happens. Obviously this can't be done with most programming environments, but it was one of VBA's strengths - well, depending on your point of view, I suppose.

虽然你可以远程调试这是不一样的,据我所知。它至少要求打开防火墙以允许调试流量(可能需要在大公司中进行一些重大签收),并且您无法调试和修复正在发生的用户问题。显然,大多数编程环境都无法做到这一点,但这是VBA的优势之一 - 我想,这取决于你的观点。

#4


0  

i think the most important difference from a business perspective is that with C# you no longer have as many "non programmers" lob managers, etc that can produce code (macros). The process is inherently more formalised.

我认为从业务角度来看,最重要的区别在于,使用C#,您不再拥有可以生成代码(宏)的“非程序员”高管经理等。这个过程本质上更加正式化。

In terms of syntax there are lots of differences... but none that are really an issue in terms of the ability to make use of the object model.

在语法方面存在很多差异......但就利用对象模型的能力而言,没有一个是真正的问题。

Sometimes you will find C# requires a few more lines of code, but in others less. Also you will find that alot of the times where you were required to use System API calls are now redundant.

有时您会发现C#需要更多代码行,但在其他代码中则更少。此外,您会发现很多时候您需要使用System API调用现在是多余的。