powerpoint vba上的奇怪错误 [英] Weird bug on powerpoint vba

查看:49
本文介绍了powerpoint vba上的奇怪错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在幻灯片上有一个mynote"文本框.如果我执行:

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

它有效.

但是如果我用这个宏附加一个形状:

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

它不起作用(没有错误消息,没有ok"消息)

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

您不能独立运行 test,因为它期望您发送 Shape 对象.但是看到您的 oShape 对象没有在您的 test 例程中使用,您不妨将其删除.

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.

这篇关于powerpoint vba上的奇怪错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆