在哪里可以找到 MS Word 的 VBA api 文档

发布于 2024-12-02 02:54:01 字数 373 浏览 0 评论 0原文

我曾经做过 VB 和 VBA 编码,但我已经有 10 多年没有做过任何 VB/VBA 工作了。我使用 Visual Studio,它内置了代码辅助来处理可用于 VBA 工作的功能。现在我是一名java开发人员,所以我没有Visual Studio,我需要编写一些VBA脚本来使用winword for 2010处理一些rtf文档。我创建了一个基本脚本,我正在使用Cscript运行它。 我尝试访问 Microsoft 网站,但

找不到我要查找的内容。应该很容易找到Google,但我确实找到了一些代码片段,但我想知道是否有一些东西可以显示 Visual Studio 之外的 winword 的 api 函数?直接通过 winword 编写脚本,所以这不是一个选择,

谢谢

, 詹姆斯

I used to do VB and VBA coding, but it's been over 10 years since I've done any VB/VBA work. I used Visual Studio and it had built in code assist to handle the functions available for VBA work. Now I"m a java developer, so I don't have Visual Studio and I need to write some VBA scripts for working with some rtf documents using winword for 2010. I've created a basic script, which I'm running with Cscript.exe off the command line in XP, but it would really help to know what functions I have available to use with my word objects.

I tried going to the Microsoft website, but couldn't find what I was looking for. This seems like something that should be really easy to locate with Google, but hasn't been. I did find some code snippets for various things, but I wanted to know if there was something that shows the api functions for winword outside of Visual Studio? I've used POI, but I need to run the scripts directly through winword, so that isn't an option.

Any ideas on this?

Thanks,
James

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

寒尘 2024-12-09 02:54:01

我相信您要查找的文档位于 MSDN 上,请尝试此处

I believe that the docs you're looking for are on MSDN, try here.

也只是曾经 2024-12-09 02:54:01

您是否查看过 Word 开发人员中心 上的许多资源链接?

这将引导您访问 Word 对象模型参考等资源。

Have you looked at the many links to resources at the Word Developer Center?

That will lead you to resources such as the Word Object Model Reference.

清风无影 2024-12-09 02:54:01

10年前我曾经做过VBA开发。这是我发现的
Word 2010 参考
http://msdn.microsoft.com/en-us/library/ff841702.aspx

在这里您可以找到旧产品的参考http://msdn.microsoft.com/en-us/库/bb726434(v=office.12).aspx

I used to do VBA development like 10 years ago. Here's what I've found
word 2010 reference
http://msdn.microsoft.com/en-us/library/ff841702.aspx

Here you'll find reference for older products http://msdn.microsoft.com/en-us/library/bb726434(v=office.12).aspx

善良天后 2024-12-09 02:54:01

对于经验丰富的 VBA 开发人员来说,这个答案可能看起来很愚蠢,但几天前我和 OP 处境相同。 Java 库有相当简单的文档。就像OP一样,我偶然发现了msdn.microsoft.com,发现没有所有MS Word VBA函数的“主”索引。如果我知道要询问什么,我总是可以找到有关函数或对象的信息,但无法浏览全面的概述。并使事情变得复杂VBA <> Visual Basic>> VB.NET>> VBScript,因此搜索经常会出现 Microsoft 对 VBA 之外的内容的“答案”。

部分问题在于,MS Word VBA 可以访问多种库,因此没有一个库(或其 API 参考)涵盖所有这些库。默认情况下,我的 Word 2007 安装链接到以下内容:

  • MS Word 12.0 对象库
  • Microsoft Office 12.0 对象库
  • OLE Automation
  • Visual Basic for Applications

这些库包含函数对象,其中一些它们使用相似的名称(例如,MsgBox 是一个函数;MessageBox 要么是函数,要么是对象)。而这仅仅是开始; Word 还可以链接到许多其他库,如 Developer->Visual Basic->Tools->References...

好消息所示,MS Word 的 Visual Basic 编辑器包含上面列出的默认库的全面离线文档。可以通过开发人员->Visual Basic->帮助->F1访问它。此命令应打开一个包含以下目录的窗口:

目录

(如果目录未显示,您可能需要单击上面指向的图标)。从这里您可以搜索或在目录中深入浏览可用的对象和函数,例如:

tocrill down

正如我所说,这个答案对于有经验的用户来说似乎是显而易见的。但我仍然把它留给那些开始在 Visual Basic for Applications 迷宫中旅行的人。

This answer may seem fatuous to experienced VBA developers, but a few days ago I was in the same boat as the OP. The Java library has fairly straightforward documentation. Like the OP I stumbled around msdn.microsoft.com and found no "master" index of all MS Word VBA functions. I could always find information on a function or object if I knew what to ask for, but no comprehensive overview to browse. And to complicate things VBA <> Visual Basic <> VB.NET <> VBScript, so searches often turned up Microsoft's "answer" for something beside VBA.

Part of the problem is, MS Word VBA has access to a wide range of libraries, so no one library (or its API reference) covers them all. By default my Word 2007 installation links to the following:

  • MS Word 12.0 Object Library
  • Microsoft Office 12.0 Object Library
  • OLE Automation
  • Visual Basic for Applications

These libraries contain functions and objects, some of which use similar names (e.g., MsgBox is a function; MessageBox either a function OR an object). And that's just the beginning; there are numerous other libraries Word may link to, as revealed by Developer->Visual Basic->Tools->References...

The good news is, MS Word's Visual Basic editor contains comprehensive offline documentation for the default libraries listed above. It is accessible through Developer->Visual Basic->Help->F1. This command should open a window with the following Table of Contents:

table of contents

(if the TOC doesn't show, you may need to click on the pointed-to icon above). From here you may search, or drill down in the TOC to browse available objects and functions, as:

toc drill down

As I said, this answer will seem obvious to the experienced user. But I leave it nonetheless for those beginning their travels in the labyrinth of Visual Basic for Applications.

眼波传意 2024-12-09 02:54:01

更新:看来 MS 已经更新/升级了 MS Word 文档。尝试:

MS 对象模型参考

< a href="https://learn.microsoft.com/en-us/office/client-developer/word/word-home" rel="nofollow noreferrer">MS Word 客户端开发人员主页

希望这些有所帮助下一个家伙。

DJ

Update: It appears MS has updated/upgraded MS Word documentation. Try:

MS Object Model Reference

MS Word Client-Developer Home

Hope these help the next guy.

dj

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文