繁体   English   中英

Powerpoint VBA 为什么运行宏会使演示文稿从头开始?

[英]Powerpoint VBA why does running a macro make the presentation start from the start again?

我只演示了一张带有许多动画的幻灯片。 一个形状与一个宏耦合,该宏应该以另一个矩形形式更改文本。

当我单击形状时,文本会更改,但仅在再次显示演示文稿时才能看到更改。 此外,运行宏使幻灯片的演示从头开始!

我想要的是让 textchange 在单击链接到宏的形状后立即可见,并让演示文稿继续......

感谢您的任何建议!

下面是宏的代码:

Sub PastekstAan()
Set myDocument = ActivePresentation.Slides(1)
With myDocument.Shapes("Actieknop: Aangepast 8").TextFrame
    If .TextRange.Text = "Replay O(A)" Then
        .TextRange.Text = "Hallo"
    Else
        .TextRange.Text = "Replay O(A)"
    End If
End With
End Sub

所以我们很清楚我们都在看什么,试试这个:

Sub PastekstAan()
Dim shp as Shape 
With ActivePresentation.Slides(1).Shapes("Actieknop: Aangepast 8").TextFrame
    If .TextRange.Text = "Replay O(A)" Then
        .TextRange.Text = "Hallo"
    End If
End With

set shp = ActivePresentation.Slides(1).Shapes.AddShape(msoShapeRectangle, -250, -350, 100, 200)
shp.Delete

' Try it with and without this, as going to the slide might
' reset the animation 
SlideShowWindows(1).View.GotoSlide(1)

End Sub

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM