问题
I have a "mynote" textbox on a slide. If I execute:
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)
回答1:
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.
来源:https://stackoverflow.com/questions/2980650/weird-bug-on-powerpoint-vba