Control over a timed MsgBox possible?

Climbo

Registered User.
Local time
Today, 08:28
Joined
May 7, 2008
Messages
16
Hello there,

I have a timed msgbox:

Code:
For x = 1 To 10
Dim oSHL As Object
On Error Resume Next
Err.Clear
Set oSHL = CreateObject("WScript.Shell")
If Err <> 0 Then
MsgBox "Error:" & Err
Else
oSHL.PopUp "Now running item " & x & " out of 10", 1, "Timed MsgBox ...", vbOKOnly
End If
Next x


I want to use vbOkCancel instead of vbOkOnly and be able to say something like if vbcancel then exit sub....

I've tried a few ways but couldnt find a working one... any ideas?

thanks.
 
Lookup the access native "MsgBox", much easier... Even access help will show you exactly how to do it...
 
Hello there,

to my knowledge, the MsgBox function does not have a timer function, that is why I'm using the above code...

in this line:

Code:
oSHL.PopUp "Now running item " & x & " out of 10", 1, "Timed MsgBox ...", vbOKOnly

the ,1, represent the number of seconds before the msgbox will dissapear...
 
No it does not... sorry...

Still the mechanism should be the same I think....
 
What about using a Pause() along with a MsgBox.

Here's the Pause() function that I googled.

Code:
Public Sub Pause(NbSec As Single) 
 Dim Finish As Single 
 Finish = Timer + NbSec 
 DoEvents 
 Do Until Timer >= Finish 
 Loop 
End Sub

Pause 1 'pause 1 second
Msgbox "Hello World" ' display msgbox
 
Hello there,

A pause followed by a msg box wouldnt do the trick since I would need to click on OK on that msgbox to continue. the goal of this exercise is to have a popup window that will dissapear in X seconds without having to press on OK...

so if I run a loop of 100,000 records that takes 5 hours to process, I can set a popup that will tell me that 1000 records were now processed, then 2000 etc...

my code does this rigtht now but I'd like to exit sub if I press cancel on this popup. Right now even if I press OK or Cancel, it just continues...
 
Oh I see.

Why not create a form to look like a MsgBox? Having the form open and close is no sweat. Plus you have more wiggle room for appearance/customization if you were so inclined.
 

Users who are viewing this thread

Back
Top Bottom