我使用代码通过命令按钮或宏将表示属性呈现给文本框或形状。当我运行它时,我会得到一个运行时错误:“SlideShowWindows(未知成员):整数超出范围。1不在1到0的有效范围内。
我该怎么办?提前感谢!
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发布于 2015-05-15 18:44:45
SlideShowWindow只能在幻灯片放映期间访问,而不是在正常/编辑模式下访问。在Set oSl = SlideShowWindows(1).View.Slide上添加以下代码行应该会有所帮助:
ActivePresentation.SlideShowSettings.runhttps://stackoverflow.com/questions/30266343
复制相似问题