1

我正在尝试准备一个宏,它将 PowerPoint2010 演示文稿中的所有方程式转换为图像,同时保留位置和动画效果/顺序。

根据此处提供的提示(感谢 Steve Rindsberg),我修改了脚本如下:

    Sub ConvertAllShapesToPic()
    Dim oSl As Slide
    Dim oSh As Shape

    On Error Resume Next

    For Each oSl In ActivePresentation.Slides
        For Each oSh In oSl.Shapes
            ' modify the following depending on what you want to
            ' convert
            Select Case oSh.Type
                Case msoTextBox, msoEmbeddedOLEObject, msoLinkedOLEObject
                    ConvertShapeToPic oSh
                Case Else
            End Select
        Next
    Next

NormalExit:
    Exit Sub

ErrorHandler:
    Resume Next

End Sub

Sub ConvertShapeToPic(ByRef oSh As Shape)
    Dim oNewSh As Shape
    Dim oSl As Slide

    Set oSl = oSh.Parent
    oSh.Copy
    Set oNewSh = oSl.Shapes.PasteSpecial(ppPasteEnhancedMetafile)(1)
    oSh.PickupAnimation
    oNewSh.ApplyAnimation
    With oNewSh
        .Left = oSh.Left
        .Top = oSh.Top
        Do
            .ZOrder (msoSendBackward)
        Loop Until .ZOrderPosition = .ZOrderPosition
        .AnimationSettings.AnimationOrder = oSh.AnimationSettings.AnimationOrder
    End With
    oSh.Delete

NormalExit:
    Exit Sub

ErrorHandler:
    Resume Next

End Sub

此脚本的问题:

  1. 所有方程都没有转换成图像。
  2. 一些没有公式的文本框正在失去其内部动画效果(例如在单击时显示第二个项目符号文本)。

我准备这个脚本的原因是因为当我将 PowerPoint 2010 转换为 Articulate 演示文稿时,由于 Articulate 09 不完全支持 PPT2010 方程,所以方程没有得到正确呈现。

我有 100 多份 PPT,几乎所有幻灯片上都有方程式。如果没有编程方法,唯一的选择是手动转换所有方程并重新应用动画效果!

感谢您提供的任何帮助:-)

谢谢!

4

2 回答 2

0

至于第一个问题,我的不好:

为了这:

For Each oSl In ActivePresentation.Slides
        For Each oSh In oSl.Shapes
            ' modify the following depending on what you want to
            ' convert
            Select Case oSh.Type
                Case msoTextBox, msoEmbeddedOLEObject, msoLinkedOLEObject
                    ConvertShapeToPic oSh
                Case Else
            End Select
        Next
Next

代替:

Dim x as long 

For x = ActivePresentation.Slides.Count to 1 Step -1
        Set oSl = ActivePresentation.Slides(x)
        For Each oSh In oSl.Shapes
            ' modify the following depending on what you want to
            ' convert
            Select Case oSh.Type
                Case msoTextBox, msoEmbeddedOLEObject, msoLinkedOLEObject
                    ConvertShapeToPic oSh
                Case Else
            End Select
        Next
Next

当我最初写这篇文章时,我可能只测试了每张幻灯片有一个方程式的幻灯片。当您单步执行一个集合并可能删除成员时,您需要向后单步执行,否则在您删除成员时索引会变得混乱。

于 2012-11-15T16:10:16.137 回答
0
Sub Test()
    Dim oSh As Shape

    For Each oSh In ActivePresentation.Slides(1).Shapes
        DoSomethingToEachShape oSh
    Next

End Sub

Sub DoSomethingToEachShape(oSh As Shape)
    Dim x As Long
    If oSh.Type = msoGroup Then
        For x = 1 To oSh.GroupItems.Count
            DoSomethingToEachShape oSh.GroupItems(x)
        Next
    Else
        Debug.Print oSh.Name
    End If
End Sub
于 2012-11-30T15:44:24.977 回答