如果ActiveX控件标签中有文本,我想使标签可见。
我尝试了不同的代码,但似乎无济于事
Private Sub makeVisible()
Set mydocument = ActivePresentation.Slides(12)
'mydocument.Select
With mydocument.Shapes("LabelFigure")
'mydocument.Shapes("LabelFigure").Select
If mydocument.Shapes("LabelFigure").OLEFormat.Object.Caption = True Then
Label2.Visible = True
End If
End With
End Sub
答案 0 :(得分:1)
应该这样做(由您决定幻灯片上是否有正确名称的形状)。
Option Explicit
Private Sub makeVisible()
' Always Dim your variables
' Including Option Explicit at the top of the module
' will enforce this
Dim mydocument As Slide
' I've changed the slide number and label names
' to match my test presentation/slide.
' Change them back to match your situation:
Set mydocument = ActivePresentation.Slides(1)
With mydocument.Shapes("Label1")
If Len(.OLEFormat.Object.Caption) > 0 Then
mydocument.Shapes("Label2").Visible = True
End If
End With
End Sub