#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Warning Box

I have a reminder set to pop up based automatically when a certain criteria
is meet. I know how to do this, but if user has minimized covered up the
current workbook, how do I make the program flash or become the active
projram on there screen to notify them to do something.

Any Ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Warning Box

On Apr 4, 4:05*pm, Looping through
wrote:
I have a reminder set to pop up based automatically when a certain criteria
is meet. I know how to do this, but if user has minimized covered up the
current workbook, how do I make the program flash or become the active
projram on there screen to notify them to do something.

Any Ideas?


Add this to your code to Maximize the screen. Change the workbook name
accordingly.

Windows("Book1").WindowState = xlMaximized
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default Warning Box

Rather than maximizing a window, which might interfere with whatever else
the user is doing, it may be better to use the FlashWindow (or
FlashWindowEx) API..

You could use the GetActiveWindow API to get the handle for the active Excel
window, then feed that handle to the FlashWindow (or FlashWindowEx) API at
the appropriate time.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default Warning Box

One could use the code below to start the flashing, but code would be needed
to turn off the flashing in response a user action.
In VB 6, I turn off suchflashung when the user moves the mouse over, or
clicks on, a control.
I guess, with Excel, you would want to stop the flashing when the user
maximizes Excel, so ypu would need to test in an application event.

Option Explicit
Private Const FLASHW_STOP = 0
Private Const FLASHW_CAPTION = &H1
Private Const FLASHW_TRAY = &H2
Private Const FLASHW_ALL = (FLASHW_CAPTION Or FLASHW_TRAY)
Private Const FLASHW_TIMER = &H4
Private Const FLASHW_TIMERNOFG = &HC

Private Type FLASHWINFO
cbSize As Long
hwnd As Long
dwFlags As Long
uCount As Long
dwTimeout As Long
End Type

Private Declare Function FlashWindow Lib "user32" (ByVal hwnd As Long,
ByVal bInvert As Long) As Long
Private Declare Function FlashWindowEx Lib "user32" (pfwi As FLASHWINFO)
As Boolean
Private Declare Function GetActiveWindow Lib "user32" () As Long

Public Sub FlashOnce()
Dim hwnd As Long
hwnd = GetActiveWindow()
FlashWindow hwnd, -1
End Sub

Public Sub KeepFlashing()
Dim FlashInfo As FLASHWINFO
Dim hwnd As Long

hwnd = GetActiveWindow()

FlashInfo.cbSize = Len(FlashInfo)
FlashInfo.dwFlags = FLASHW_ALL Or FLASHW_TIMER
FlashInfo.dwTimeout = 0
FlashInfo.hwnd = hwnd
FlashInfo.uCount = 0

FlashWindowEx FlashInfo
End Sub


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default Warning Box

In a VB 6 form, here's what I do:

Define module scope variable:
Private blnStopFlash As Boolean

In the click event for the button that starts things running, include near
the beginning:

blnStopFlash = False
With FlashInfo
.cbSize = Len(FlashInfo)
.hwnd = Me.hwnd
.dwFlags = FLASHW_ALL Or FLASHW_TIMER
.dwTimeout = 0
.uCount = 0
End With

For Excel, GetActiveWindow has to be used instead of Me.hwnd

When the click event wants to signal that it is done, start the flashing by
using:

FlashWindowEx FlashInfo
blnStopFlash = True

Include the following Sub:

Private Sub StopFlash(FlashInfoLocal As FLASHWINFO)
If blnStopFlash Then
FlashInfoLocal.dwFlags = FLASHW_STOP
FlashWindowEx FlashInfoLocal
blnStopFlash = False
End If
End Sub

Wherever needed, e.g., in all Click and MouseDown events, include the
following:
StopFlash FlashInfo

If Excel is minimized, I guess that only the relevant application events
need to contain

StopFlash FlashInfo

--
http://www.standards.com/; See Howard Kaikow's web site.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pop up warning Michael Excel Discussion (Misc queries) 0 January 16th 08 04:02 PM
warning box delete automatically Excel Worksheet Functions 3 October 20th 07 03:31 PM
Warning!!! Paul Excel Worksheet Functions 6 August 2nd 05 05:58 PM
Warning Dan Excel Programming 3 September 15th 04 08:37 PM
How to put in a warning? Teak[_2_] Excel Programming 4 April 15th 04 12:35 PM


All times are GMT +1. The time now is 06:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"