[英]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.