|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
程序代码最后加一句msgBox,在出现对话框后,如果excel不是当前程序,窗体自然会闪烁提醒
如果不想出现对话框,可以使用下面的代码:
- Public Enum enuFlashOptions
- FLASHW_ALL = &H3 ' Flash both the window caption and taskbar button.
- ' This is equivalent to setting the FLASHW_CAPTION | FLASHW_TRAY flags.
- FLASHW_CAPTION = &H1 ' Flash the window caption.
- FLASHW_STOP = 0 ' Stop flashing. The system restores the window to its original state.
- FLASHW_TIMER = &H4 ' Flash continuously, until the FLASHW_STOP flag is set.
- FLASHW_TIMERNOFG = &HC ' Flash continuously until the window comes to the foreground.
- FLASHW_tray = &H2
- End Enum
- Public Type FlashWindowInfo
- cbSize As Long
- hwnd As Long
- dwFlags As Long
- uCount As Long
- dwTimeout As Long
- End Type
- Declare Function FlashWindowEx Lib "user32.dll" (ByRef pInfo As FlashWindowInfo) As Boolean
- Public Sub FlashWindow(ByVal hwnd As Long, _
- ByVal FlashWindowInfoFlags As enuFlashOptions, _
- Optional ByVal intFlashTimes As Long = 5)
-
- Dim info As FlashWindowInfo
- With info
- .cbSize = Len(info)
- .dwFlags = FlashWindowInfoFlags ' See enumeration for flag values
- .dwTimeout = 0 'Flash rate in ms or default cursor blink rate
- .hwnd = hwnd
- .uCount = intFlashTimes ' Number of times to flash
- End With
- FlashWindowEx info
- End Sub
- Sub flash()
- FlashWindow Application.hwnd, FLASHW_TIMERNOFG Or FLASHW_tray, 0
- End Sub
- Sub test()
- Application.OnTime Now() + TimeValue("00:00:04"), "flash"
- End Sub
复制代码 |
|