在 PowerPoint 2007 中创建新的方程式宏 [英] Create new Equation Macro in PowerPoint 2007

查看:70
本文介绍了在 PowerPoint 2007 中创建新的方程式宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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

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

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) 在插入菜单上,单击对象.

1) On the Insert menu, click Object.

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

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

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

(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)

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

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....

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

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

推荐答案

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

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.

希望这会有所帮助.

这篇关于在 PowerPoint 2007 中创建新的方程式宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆