Weird bug on powerpoint vba
I have a "mynote" textbox on a slide. If I execu开发者_Go百科te:
Sub test()
If ActiveWindow.Selection.SlideRange.Shapes("mynote").Visible Then
MsgBox "ok"
End If
end sub
It works.
But If I attach a shape with this macro:
Sub test(oShape As Shape)
If ActiveWindow.Selection.SlideRange.Shapes("mynote").Visible Then
MsgBox "ok"
End If
end sub
It doesn't work (no error message, no "ok" message)
It will depend on how you call it from another sub routine - you have to send in a shape. Like:
Sub testYourTest()
Dim sh As Shape
Set sh = ActivePresentation.Slides(4).Shapes(1)
test sh
End Sub
You can't run test
stand-alone because it is expecting you to send in a Shape
object. But seeing as your oShape
object is not being used in your test
routine, you may as well remove it.
精彩评论