再次测试,发现在access中单独使用这段代码,是可以弹出并延时自动关闭消息窗口的。
之所以之前弹出的窗体不能自动关闭,是因为代码段放到了一个定时器事件内部了,代码段见下面,猜想是popup代码段没有得到有别与窗体定时器的其它定时器。
Private Sub Form_Timer()
Dim objShell As Object
Me.Label49.Caption = Now()
If c = 0 Then
Me.Label41.ForeColor = 2366701
Me.Label41.Left = Me.Label41.Left + 500
If Me.Label41.Left >= Me.InsideWidth - Me.Label41.Width Then
Set objShell = CreateObject("Wscript.Shell")
objShell.PopUp "即将切换文字移动方向,1秒后提示窗体自动消失", 1, "提示", 64
Set objShell = Nothing
c = 1
End If
Else
Me.Label41.Left = Me.Label41.Left - 500
Me.Label41.ForeColor = 12874308
If Me.Label41.Left <= 500 Then
Me.Label41.Left = 0
End If
If Me.Label41.Left <= 0 Then c = 0
End If
End Sub