Flash a MsgBox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'd like to flash a Msgbox on the screen after a process has finished.
However, I don't want the user to have to press enter (i.e. vbOKCancel). Is
there a way to flash a message and won't require the user to click thru it??
Thanks.
 
Nope msgboxes require user input. You could however load a form that is on a
timer... In the on open for the form use something like this

application.ontime now + timevalue("00:00:10"), "unload me"

That code is untested but I think it will work.

HTH
 
Here is an example of a timed MsgBox

Dim cTime As Long
Dim WSH As Object


Set WSH = CreateObject("WScript.Shell")
cTime = 1 ' 1 secs
Select Case WSH.Popup("Open an Excel file?!", cTime, "Question",
vbOKCancel)
Case vbOK
MsgBox "You clicked OK"
Case vbCancel
MsgBox "You clicked Cancel"
Case -1
MsgBox "Timed out"
Case Else
End Select


As you can see, it can be OK, Cancel or timed out.


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
As I recall, you can't execute a command with Ontime. You can executed a
macro that has the command.
 
On Wed, 23 Mar 2005 09:39:01 -0800, =?Utf-8?B?U3RldmVy?= wrote...
I'd like to flash a Msgbox on the screen after a process has finished.
However, I don't want the user to have to press enter (i.e. vbOKCancel). Is
there a way to flash a message and won't require the user to click thru it??
Thanks.

Just some quick programming!

Let's be creative and use a flashing textbox

*********************************
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sub Flashing_Message()
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, _
191.25, 89.25, 245.25, 130.5).Select
Selection.Characters.Text = "Task complete"

For x = 1 To 20

With Selection.Characters(Start:=1, Length:=16).Font
.Name = "Arial"
.FontStyle = "Vet"
.Size = 18
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = x
End With

With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.ReadingOrder = xlContext
.Orientation = xlHorizontal
.AutoSize = False
.ShapeRange.Fill.Visible = msoTrue
.ShapeRange.Fill.Solid
.ShapeRange.Fill.ForeColor.SchemeColor = x
.ShapeRange.Fill.Transparency = 0#
.ShapeRange.Line.Weight = 4.5
.ShapeRange.Line.DashStyle = msoLineSolid
.ShapeRange.Line.Style = msoLineSingle
.ShapeRange.Line.Transparency = 0#
.ShapeRange.Line.Visible = msoTrue
.ShapeRange.Line.ForeColor.SchemeColor = 64
.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
End With

Sleep 100

With Selection.Characters(Start:=1, Length:=16).Font
.Name = "Arial"
.FontStyle = "Vet"
.Size = 18
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = x + 1
End With

With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.ReadingOrder = xlContext
.Orientation = xlHorizontal
.AutoSize = False
.ShapeRange.Fill.Visible = msoTrue
.ShapeRange.Fill.Solid
.ShapeRange.Fill.ForeColor.SchemeColor = x + 1
.ShapeRange.Fill.Transparency = 0#
.ShapeRange.Line.Weight = 4.5
.ShapeRange.Line.DashStyle = msoLineSolid
.ShapeRange.Line.Style = msoLineSingle
.ShapeRange.Line.Transparency = 0#
.ShapeRange.Line.Visible = msoTrue
.ShapeRange.Line.ForeColor.SchemeColor = 64
.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
End With

Next

For Each S In ActiveSheet.Shapes
S.Select
Selection.Delete
Next

End Sub
***********************************
--
Met vriendelijke groeten / Mit freundlichen Grüßen / With kind
regards/Avec mes meilleures salutations
BBert

April 20, 1986
Celtics (135) - Bulls (131)
Larry Bird: "God disguised as Michael Jordan"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top