单击形状时,powerpoint vba宏未运行

时间:2014-04-11 03:15:49

标签: vba powerpoint

我创建了一个powerpoint演示文稿,只需单击幻灯片上的形状即可运行宏。但是,我无法从演示文稿中运行宏,只能从编辑器中运行。

我搜索了这个网站,但只找到了使用activepresentation而不是activewindow的建议。但是,我已经在使用activepresenation,您可以在我的下面的代码中看到。即使是msgbox也没有出现。有任何想法吗?

Sub start_game()

MsgBox "making things invisible"

Dim i As Integer
Dim slide_count As Integer
Dim shape As shape

i = 1
slide_count = ActivePresentation.Slides.Count
MsgBox slide_count

For i = 1 To slide_count

For Each shape In ActivePresentation.Slides(i).Shapes
If shape.Name = "answer_block" Then
ActivePresentation.Slides(i).Shapes("answer_block").Visible = False
End If
Next

Next i

End Sub

0 个答案:

没有答案