在 PowerPoint 2007 中创建新的方程宏

发布于 2024-12-11 03:45:12 字数 762 浏览 0 评论 0原文

我正在帮助我的一位教授,但本应是一项简单的任务却开始让我感到沮丧。

我没有任何使用 Visual Basic 在 MS Office 2007(特别是 PowerPoint '07)中创建宏的经验。

我所需要的只是一个用于将新方程插入 PowerPoint 幻灯片的宏,然后该宏将用作快速访问工具栏上的按钮。该宏应执行以下两项任务:

1) 在“插入”菜单上,单击“对象”。

2) 在对象类型列表中,单击 Microsoft Equation 3.0。

(摘自http://office.microsoft。 com/en-us/powerpoint-help/insert-an-equation-HP005194680.aspx ~我知道它“适用”于 2003 年,但在 2003 年是相同的过程2007)

我真的很抱歉在这里问这么一个简单的问题,但我一直在网上寻求帮助,但找不到我能理解的 VB 库的简单参考。据我了解,我需要向下导航 PowerPoint、演示文稿、幻灯片对象,然后添加形状?或者也许可以通过 CommandBars 对象来完成?我觉得这是一个非常简单的问题,可以由你们中的一位知识渊博的人来解决,这样我就可以免于再花几个小时的谷歌搜索,而这些搜索却让我无处可去……

基本上,最终结果将是快速访问工具栏上的一个按钮这将打开方程编辑器 3.0

I'm helping out one of my professors but what should be a simple task is starting to frustrate me.

I do not have any experience with Visual Basic used to create macros in MS Office 2007, specifically PowerPoint '07.

All I need is a macro for inserting a new equation into a PowerPoint slide, the macro will then be used as a button on the quick access toolbar. The macro should preform these two tasks:

1) On the Insert menu, click Object.

2) In the Object type list, click Microsoft Equation 3.0.

(taken from http://office.microsoft.com/en-us/powerpoint-help/insert-an-equation-HP005194680.aspx ~I know it "applies" to 2003 but it is the same process in 2007)

I'm really sorry to be asking such a simple question here but I have been all over the net looking for help and can't find a simple reference of the VB Library that I can understand. From what I do understand I need to navigate down through the objects PowerPoint, Presentation, Slide, and then add a Shape? Or maybe it can be done through the CommandBars object? I feel like this is a really simple problem that can solved by one of you knowledgeable fellows to save me from several more hours of Google searches that get me no where....

Basically the end result would be a button on the quick access toolbar that would open the Equation Editor 3.0

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

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

发布评论

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

评论(1

郁金香雨 2024-12-18 03:45:12

Microsoft Equation 3.0 创建一个 OLE 对象,可以使用以下代码创建和打开该对象:

Dim SlideNumber As Integer
Dim ShapesCount As Integer

SlideNumber = ActiveWindow.View.Slide.SlideIndex
With ActivePresentation.Slides(SlideNumber)
    .Shapes.AddOLEObject Left:=100, Top:=100, Width:=200, Height:=100, ClassName:="Equation.3", DisplayAsIcon:=False
    ShapesCount = .Shapes.Count
    .Shapes(ShapesCount).OLEFormat.Activate
End With

值得注意的是,上面的代码需要选择一张幻灯片才能工作。如果没有选择幻灯片,则会抛出错误。您可能希望添加额外的代码以避免此类复杂情况。

希望这有帮助。

Microsoft Equation 3.0 creates an OLE Object, which can be created and opened with this code:

Dim SlideNumber As Integer
Dim ShapesCount As Integer

SlideNumber = ActiveWindow.View.Slide.SlideIndex
With ActivePresentation.Slides(SlideNumber)
    .Shapes.AddOLEObject Left:=100, Top:=100, Width:=200, Height:=100, ClassName:="Equation.3", DisplayAsIcon:=False
    ShapesCount = .Shapes.Count
    .Shapes(ShapesCount).OLEFormat.Activate
End With

It's worth noting that the code above needs a slide to be selected to work. If no slide is selected, it will throw an error. You may wish to add additional code to avoid such complications.

Hope this helps.

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