VBA PowerPoint 在线指南和如何录制宏

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/127006/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 09:21:31  来源:igfitidea点击:

VBA PowerPoint Online Guide and How to Record a Macro

vbapowerpointpowerpoint-vba

提问by Knobloch

Could anyone recommend to me a good online guide to PowerPoint VBA? Also, does anyone has advice on how to record a macro in PowerPoint?

谁能向我推荐一个好的 PowerPoint VBA 在线指南?另外,有没有人有关于如何在 PowerPoint 中录制宏的建议?

回答by Bruno Leite

Microsoft remove macro recorder from PowerPoint 2007.

Microsoft 从 PowerPoint 2007 中删除宏录制器。

To view the struct of objects use Watch (Shift +F9) in object.

要查看对象的结构,请在对象中使用 Watch (Shift +F9)。

For Example

例如

dim ppt as powerpoint.Presentation

set ppt =activepresentation

add watch to ppt to view the struct of object Presentation

在ppt中添加watch查看对象Presentation的struct

otherwise

除此以外

Add a new class module

添加一个新的类模块

in the class declare

在类中声明

Private WithEvents ppt As PowerPoint.Application

in comon module declare one instance from classCreate(default is Class1) using

在通用模块中,使用 classCreate(默认为 Class1)声明一个实例

set x= new class1

Now in module class you can get events for you presentation (in left combo up the code window)

现在在模块类中,您可以为您的演示获取事件(在代码窗口的左侧组合中)

Bruno Leite

布鲁诺·莱特

Office Developer

办公开发人员

回答by Knobloch

To record a powerpoint macro:

要录制 PowerPoint 宏:

  1. In the menu bar, click on Tools
  2. Mouse over Macro > and the submenu will be displayed
  3. Click the Record button - a new toolbar will be displayed
  4. Do your thing
  5. Click the stop button on the new macro toolbar
  1. 在菜单栏中,单击工具
  2. 将鼠标悬停在宏 > 上,将显示子菜单
  3. 单击“录制”按钮 - 将显示一个新工具栏
  4. 做你的事
  5. 单击新宏工具栏上的停止按钮

Click on Tools->Macro->Macros. Find the macro you just recorded and click the Edit button. That will show you what was recorded. Make your modifications and click the triangular run button (or push F5) to run your code.

点击工具->宏->宏。找到您刚刚录制的宏,然后单击“编辑”按钮。这将向您显示记录的内容。进行修改并单击三角形运行按钮(或按 F5)以运行您的代码。

As far as an online guide, I usually think of a question and use Googleor ask a question here on StackOverflow.com. I've been able to answer most of my questions that way, I haven't found a particular main resource for all things Powerpoint VBA.

至于在线指南,我通常会想到一个问题并使用谷歌或在 StackOverflow.com 上提出问题。我已经能够以这种方式回答我的大部分问题,我还没有找到有关 Powerpoint VBA 的所有内容的特定主要资源。

Also, you can find answers that can help you by looking into VBA articles for other MS Office products - a lot of things that are not Powerpoint-specific (general VBA) will be the same as for the other products.

此外,您可以通过查看其他 MS Office 产品的 VBA 文章找到可以帮助您的答案 - 很多不是 Powerpoint 特定(通用 VBA)的内容将与其他产品相同。

回答by scunliffe

Can you describe what you are hoping to accomplish? There are dozens of VBA books out there for Word, Excel, etc. but "programming" in PowerPoint is not so common.

你能描述一下你希望实现的目标吗?有许多用于 Word、Excel 等的 VBA 书籍,但 PowerPoint 中的“编程”并不常见。

Here's a brief online "FAQ" for the newcommer:

以下是针对新手的简短在线“常见问题解答”:

http://skp.mvps.org/index.html#newbie

http://skp.mvps.org/index.html#newbie

and a general howto:

和一般方法:

http://www.pptfaq.com/FAQ00033.htm

http://www.pptfaq.com/FAQ00033.htm