面向 Office VBA 开发人员的文档资源
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1543424/
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
Documentation Resource for Office VBA developers
提问by Kevin Boyd
Where do I find helpful documentation for VBA programming? something like SitePoint for HTML development. MSDN simply lists down and describes the operation and properties/methods of classes instead of explaining what they are used for, or when to use them.
在哪里可以找到有关 VBA 编程的有用文档?类似于用于 HTML 开发的 SitePoint。MSDN 只是列出并描述了类的操作和属性/方法,而不是解释它们的用途或何时使用它们。
Books are also welcome.
也欢迎书籍。
采纳答案by jtolle
I have been working with Excel/VBA on and off over the past two years and have been very disappointed in the quality of the basic documentation. The "help" file is almost worthless. The MSDN version of the same thing is better because it has better internal links, but still quite thin. Here are some resources which I have found helpful:
在过去的两年里,我一直断断续续地使用 Excel/VBA,对基本文档的质量感到非常失望。“帮助”文件几乎毫无价值。同样东西的 MSDN 版本更好,因为它有更好的内部链接,但仍然很薄。以下是我发现有用的一些资源:
Writing Excel Macros with VBA, 2nd Edition by Steven Roman. Chapters 5-8 have a decent "tour" of the language (you can find snippets in Google Books):
使用 VBA 编写 Excel 宏,第 2 版,Steven Roman。第 5-8 章对该语言进行了不错的“导览”(您可以在 Google 图书中找到片段):
http://www.amazon.com/Writing-Excel-Macros-VBA-2nd/dp/0596003595#noop
http://www.amazon.com/Writing-Excel-Macros-VBA-2nd/dp/0596003595#noop
The VB 6.0 Programmer's Guide, which mostly also applies to VBA:
VB 6.0 程序员指南,大部分也适用于 VBA:
http://msdn.microsoft.com/en-us/library/aa716285(VS.60).aspx
http://msdn.microsoft.com/en-us/library/aa716285(VS.60).aspx
There are also various Excel "guru" consultant websites out there that have a lot of example material. Much of it is pitched Excel in general or to non-programmers, but can still be quite useful for picking up VBA in general. Two such sites in particular are from ChuckChip Pearson and Charles Williams:
还有各种 Excel“大师”顾问网站,其中包含大量示例材料。其中大部分内容通常是针对 Excel 或非程序员的,但对于一般的 VBA 学习仍然非常有用。两个这样的网站特别来自ChuckChip Pearson 和 Charles Williams:
http://www.cpearson.com/excel/mainpage.aspx
http://www.cpearson.com/excel/mainpage.aspx
http://www.decisionmodels.com/
http://www.decisionmodels.com/
I was about to type a disparaging comment about how I never found a VBA language spec, but I figured I'd Google it again and lo and behold, from only just about a year ago:
我正要写一篇关于我从未找到 VBA 语言规范的贬低评论,但我想我会再次谷歌一下,瞧,大约一年前:
http://msdn.microsoft.com/en-us/library/dd361851(PROT.10).aspx
http://msdn.microsoft.com/en-us/library/dd361851(PROT.10).aspx
This might contain the answers to some questions I have resolved only by experimentation and encoding the results as unit tests...
这可能包含我仅通过实验和将结果编码为单元测试来解决的一些问题的答案......
回答by Oorang
If you are finding the MS documentation, one approach is to make use of the macro recorder. It won't generate high quality code, but if you record the actions you want your program to take and review the code it generates using F1 on any object you want to look at deeper, it can be a good start. You just have to use a little common sense and clean up the macro code after.
如果您要查找 MS 文档,一种方法是使用宏记录器。它不会生成高质量的代码,但是如果您记录您希望程序执行的操作并在您想要深入查看的任何对象上使用 F1 查看它生成的代码,这可能是一个好的开始。您只需要使用一点常识并在之后清理宏代码即可。
回答by Russ Cam
Any particular Object models that you were interested in (Excel Object Model, Access Object Model, etc) or all of them? I had a copy of Excel 2003 VBA from Wrox that was pretty decent, they have updated it for Excel 2007(although I don't believe that there would be a difference between the 2003 and 2007 versions as extending VBA was pulled years ago and there was a push to move to VSTO).
您感兴趣的任何特定对象模型(Excel 对象模型、Access 对象模型等)或所有这些模型?我有一份来自 Wrox 的 Excel 2003 VBA 副本,相当不错,他们已经为 Excel 2007 更新了它(虽然我不相信 2003 和 2007 版本之间会有区别,因为扩展 VBA 几年前被拉是推动转向VSTO)。
As a general VBA reference, you'd be best to pick up a good VB6 resource, since if I recall correctly, VBA is a subset of the VB6 language. Something like Professional Visual Basic 6 Programmers Referencewould be good.
作为一般的 VBA 参考,您最好选择一个好的 VB6 资源,因为如果我没记错的话,VBA 是 VB6 语言的一个子集。像Professional Visual Basic 6 Programmers Reference这样的东西会很好。
EDIT:
编辑:
The MSDN Visual Basic for Applications pagelooks like a good starting point for resources. Here are the Language References
在MSDN Visual Basic应用程序页面看起来像一个很好的出发点资源。这里是语言参考
回答by user1762148
Yes, VBA and MSOffice-specific documentation has gone from barely-with-value in older versions of MSDN Library, to now completely unusable shite.
是的,VBA 和 MSOffice 特定的文档已经从旧版本的 MSDN 库中几乎没有价值,现在完全无法使用。
Some idiot decided it would be A GOOD THING (TM) to decouple objects, methods, and properties, instead treating each as an independent, standalone concept. In the good ol' days, you could look up an object class (say, 'Range' for excel), click a link for Properties or Methods to see what p's or m's were supported for that class, and what they did specifically for that class.
一些白痴认为将对象、方法和属性解耦是一件好事 (TM),而不是将每个都视为独立的独立概念。在过去的好日子里,您可以查找一个对象类(例如,excel 的“范围”),单击属性或方法的链接以查看该类支持哪些 p 或 m,以及它们专门为此做了什么班级。
Now, all we get is some generic description of the class, no link to it's properties and methods. Properties and Methods are listed alphabetically as their own generic entity, separate from the object classes.
现在,我们得到的只是类的一些通用描述,没有指向它的属性和方法的链接。属性和方法作为它们自己的通用实体按字母顺序列出,与对象类分开。
So, there's no easy way, when programming, to find out how to USE an object class. What methods are available? What Properties? What do they do? We no longer know...
因此,在编程时没有简单的方法来找出如何使用对象类。有哪些方法可用?什么属性?他们在做什么?我们不再知道...