且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将Excel VBA宏转换为EXE文件?

更新时间:2023-02-16 21:01:13

这个答案可能也不能令人满意,但事实是Excel并不是生成独立应用程序(exe)的编程工具.

This answer might not be satisfying too but the fact is that Excel is no programming tool to produce stand alone applications (exe).

因此,您需要使用像VB.NET或C#这样的 real 编程语言(和工具)重新编写项目.VBA(用于应用程序的Visual Basic)旨在按其名称所述在应用程序中运行(例如Excel或其他Office应用程序),但不能独立运行.

Therefore you need to re-write your project using a real programming language (and tool) like VB.NET or C#. VBA (Visual Basic for Applications) is meant to run in applications as its name says (like Excel or other Office applications) but not stand alone.

如果计划单独使用应用程序,则无法仅通过转换代码(通过按按钮或其他方式)来转换代码,您将需要用另一种编程语言完全(手动)完全重写整个项目/工具.(exe)没有Excel.

There is no way of just converting the code (by pressing a button or something) you will need to re-write the whole project/tool completely (by hand) in another programming language if you plan to use your application stand alone (exe) without Excel.

请注意,即使VBA和VB.NET使用类似的语法,也不能仅复制代码.这是2种完全不同的语言,需要重新编写代码.即使结果看起来相似,也不一样.

Please note that even if VBA and VB.NET use similar syntax you cannot just copy the code. These are 2 completely different languages and the code needs to be re-written. Even if the result would look similar it is not the same.