Office VBA 会发生什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/441248/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What will happen with Office VBA?
提问by Andomar
The company I work at is run on Excel sheets. Several of those sheets have some form of VBA code embedded. I'm doing some maintenance on them, but it feels really dated.
我工作的公司在 Excel 工作表上运行。其中一些工作表嵌入了某种形式的 VBA 代码。我正在对它们进行一些维护,但感觉真的过时了。
What's going to happen to Office VBA?
Office VBA 会发生什么?
Why hasn't Microsoft released an embedded .NET macro language for Office?
为什么 Microsoft 没有为 Office 发布嵌入式 .NET 宏语言?
采纳答案by Mike Woodhouse
Short answer: you're probably fine for a while yet.
简短的回答:你可能还好一段时间。
Long answer: VB6 (which is what VBA really is) is pretty much a dead, unsupported language, last updated a decade back with an IDE from the same period. It's only still around because it's embedded in Office and there are millions of Office apps that would stop working if VBA was removed or changed. Not to mention millions of mightily annoyed users.
长答案:VB6(这就是 VBA 的真正含义)几乎是一种死的、不受支持的语言,上次更新是十年前的同一时期的 IDE。它仍然存在是因为它嵌入在 Office 中,并且如果删除或更改 VBA,数百万个 Office 应用程序将停止工作。更不用说数百万非常恼火的用户了。
So how to move forward? Can Office be re-implemented in managed code? Does Microsoft want to do that at all? Are they going to make an even bigger backward-compatibility break than the Ribbon and just discard the notion of macro recording and interpreted embedded code? I just can't see my users taking to VB.NET in Visual Studio, using COM Interop and whatnot.
那么如何前进呢?可以在托管代码中重新实现 Office 吗?微软真的想这样做吗?他们是否会做出比 Ribbon 更大的向后兼容性中断,而只是放弃宏记录和解释嵌入代码的概念?我只是看不到我的用户在 Visual Studio 中使用 COM Interop 等访问 VB.NET。
If I had to put money on one outcome (and I wouldn't want to bet much even then) I'd be looking at the Dynamic Language Runtimeand the fact that several languages are in various states of preparedness to run on it. Suppose the DLR, with some suitable replacement or wrapper for the Office app COM model, were to replace the VB6 runtime. Further, suppose VBA were implemented as a DLR language. Now legacy VBA will continue to run, just on a different (modern, supported) interpreter and into the bargain, we can program Excel macros in Python, Ruby or whatever other DLR language takes our fancy.
如果我不得不在一个结果上投入资金(即使到那时我也不想下太多赌注),我会查看动态语言运行时以及几种语言处于不同的准备状态以运行它的事实。假设 DLR 为 Office 应用程序 COM 模型提供了一些合适的替代品或包装器,以替代 VB6 运行时。此外,假设 VBA 是作为 DLR 语言实现的。现在,遗留的 VBA 将继续运行,只是在不同的(现代的、受支持的)解释器上运行,我们可以用 Python、Ruby 或我们喜欢的任何其他 DLR 语言编写 Excel 宏。
But that's just my best guess - I have no idea whether or not it's anywhere near to waht will actually happen. I'd surely love to be able to program Excel macros in Ruby, though.
但这只是我最好的猜测——我不知道它是否真的会发生。不过,我当然希望能够在 Ruby 中编写 Excel 宏。
回答by Andru Luvisi
They are adding VBA support to the next version of Office for the Mac, so I suspect that it'll be around for a while.
他们正在为 Mac 的下一个版本的 Office 添加 VBA 支持,所以我怀疑它会存在一段时间。
回答by Iain Holder
I would say it's time for you to dive into .NET.
我会说是时候让您深入研究 .NET 了。
You can call .NET libraries from Excel.
您可以从 Excel 调用 .NET 库。
回答by Andomar
Well I'm a experienced .NET programmer. I tried Tools for Office which is a pain to use and it requires you to distribute assemblies (LOL.) There's no way Finance or Delivery is going to use that. We had a good laugh before hitting uninstall.
好吧,我是一位经验丰富的 .NET 程序员。我尝试了 Office 工具,它使用起来很麻烦,它需要您分发程序集(大声笑)。财务或交付无法使用它。在点击卸载之前,我们笑得很开心。
We tried Google Docs, which was surprisingly flexible, but still not as powerful as Excel macro's. Microsoft has stagnated since 2000, and Google is moving fast, so in a few years the answers might be different. VBA itself is actually lesspowerful today due to all the security nonsense.
我们尝试了 Google Docs,它非常灵活,但仍然不如 Excel 宏强大。微软自 2000 年以来一直停滞不前,而谷歌发展迅速,所以几年后答案可能会有所不同。由于所有的安全废话,VBA 本身在今天实际上不那么强大。
In the end I still got a button in their sheet to do what they want, and they can make minor changes to the code if they like. It's weird that VBA is the way to go for something that I suspect all finance departments in the world use.
最后,我在他们的工作表中仍然有一个按钮可以做他们想做的事情,如果他们愿意,他们可以对代码进行细微的更改。奇怪的是,VBA 是我怀疑世界上所有财务部门都在使用的方法。
回答by christian pocong
VBA is worth learning till the time Excel is there because whatever you do in Excel, VBA can automate that to save your time and reduce the error chance. You can simply run code and sit on chair rest task will be done by VBA code. ... With VBA you can learn the SQL and Excel (if you already know then it is too good).
在 Excel 出现之前,VBA 值得学习,因为无论您在 Excel 中做什么,VBA 都可以自动执行,以节省您的时间并减少出错的机会。您可以简单地运行代码,坐在椅子上休息的任务将由 VBA 代码完成。...使用 VBA,您可以学习 SQL 和 Excel(如果您已经知道那就太好了)。
回答by MarlonRibunal
I kinda came across the same line of thinking yesterday. What a coincidence. Suddenly the boss at my parttime job was looking for an Excel application I created 3 years ago (left the company in 2007 and came back to them as parttime employee to augment my fulltime job). I remember I had converted that to an MS Access 2003 application; but the app needs to be updated to fulfill newer requirements. Guess what, I think I already forgot VBA. It is not the right time to go back and re-learn things from ground up. I am moving on with C# 2.0/3.0. Rebuilding that MS Access 2003 application with C# 3.0 will be a great learning experience, I'm sure!
昨天我有点遇到同样的想法。多么巧合。突然间,我的兼职老板正在寻找我 3 年前创建的 Excel 应用程序(于 2007 年离开公司,并以兼职员工的身份回到他们那里以增加我的全职工作)。我记得我已经将它转换为 MS Access 2003 应用程序;但该应用程序需要更新以满足更新的要求。你猜怎么着,我想我已经忘记了 VBA。现在不是回去重新学习东西的合适时机。我继续使用 C# 2.0/3.0。我敢肯定,使用 C# 3.0 重建 MS Access 2003 应用程序将是一次很棒的学习体验!
@IainMH is right..." it's time for you to dive into .NET"
@IainMH 是对的......“是时候让你深入了解 .NET”