是否可以在Visual Studio中编写Excel VBA代码 [英] Is it possible to write Excel VBA Code in Visual Studio
问题描述
有没有一种方法可以在Visual Studio中编写VBA代码.如果没有,还有其他选择吗?
Is there a way to write VBA Code in Visual Studio. If not is there any other alternatives?
推荐答案
只能使用VBA IDE在Excel内编写Excel的VBA代码.VBA项目存储为Excel文件的一部分,无法加载到Visual Studio中.
VBA code for Excel can only be written inside Excel using the VBA IDE. VBA projects are stored as part of the Excel file and cannot be loaded into Visual Studio.
但是,您可以使用Visual Studio为Excel编写VSTO(用于Office的Visual Studio工具)托管的加载项.以下MSDN页面涵盖了使用VBA和VSTO进行开发的过程.
However, you can write VSTO (Visual Studio Tools for Office) managed add-ins for Excel using Visual Studio. The following MSDN page covers both developing with VBA and VSTO.
您还可以使用VBA的互操作功能来消耗通过VBA代码在Visual Studio中编写的(COM)对象.
You could also use the interop features of VBA to consume a (COM) object written in Visual Studio from your VBA code.
这篇关于是否可以在Visual Studio中编写Excel VBA代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!