首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行时错误'-2147188160 (80048240)‘’

运行时错误'-2147188160 (80048240)‘’
EN

Stack Overflow用户
提问于 2015-05-15 18:24:12
回答 1查看 3.3K关注 0票数 0

我使用代码通过命令按钮或宏将表示属性呈现给文本框或形状。当我运行它时,我会得到一个运行时错误:“SlideShowWindows(未知成员):整数超出范围。1不在1到0的有效范围内。

我该怎么办?提前感谢!

代码语言:javascript
复制
Sub ReportStuff()
    Dim oSl As Slide
    Dim oSh As Shape

    Set oSl = SlideShowWindows(1).View.Slide

    ' Test to see if the shape's already there:
    Set oSh = IsItThere(oSl, "My Text Box")

    ' If it's not there, add it:
    If oSh Is Nothing Then
       Set oSh = oSl.Shapes.AddTextbox(msoTextOrientationHorizontal, 100, 100, 200, 50)
       oSh.Name = "My Text Box"
    End If

    With oSh.TextFrame.TextRange
        .Text = "Index: " & oSl.SlideIndex & " ID: " & oSl.SlideID & " File: " & ActivePresentation.FullName
    End With

End Sub

Function IsItThere(oSl As Slide, sName As String) As Shape
   Dim oSh As Shape
   For Each oSh In oSl.Shapes
      If oSh.Name = sName Then
         Set IsItThere = oSh
         Exit Function
      End If
   Next
End Function
EN

回答 1

Stack Overflow用户

发布于 2015-05-15 18:44:45

SlideShowWindow只能在幻灯片放映期间访问,而不是在正常/编辑模式下访问。在Set oSl = SlideShowWindows(1).View.Slide上添加以下代码行应该会有所帮助:

代码语言:javascript
复制
ActivePresentation.SlideShowSettings.run
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30266343

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档