在PowerPoint中VBA奇怪的bug(Weird bug on powerpoint vba)

2019-10-22 18:56发布

我有幻灯片上的“mynote”文本框。 如果我执行:

Sub test()

            If ActiveWindow.Selection.SlideRange.Shapes("mynote").Visible Then
                MsgBox "ok"
            End If
end sub

有用。

但是,如果我附上一个形状与此宏:

Sub test(oShape As Shape)

            If ActiveWindow.Selection.SlideRange.Shapes("mynote").Visible Then
                MsgBox "ok"
            End If
end sub

它不工作(没有错误信息,没有“OK”消息)

Answer 1:

这将取决于你如何从另一个子程序调用它 - 你有一个形状送。 喜欢:

Sub testYourTest()
    Dim sh As Shape
    Set sh = ActivePresentation.Slides(4).Shapes(1)
    test sh
End Sub

您不能运行test ,因为它期待你在发送独立Shape对象。 但看到你的oShape对象未在您使用的test程序,你不妨将其删除。



文章来源: Weird bug on powerpoint vba