Message box that does not interrupt code

  • Thread starter Thread starter Claude
  • Start date Start date
C

Claude

Hi all,

Is it possible to configure the msgbox() in such a way
that a message is displayed (say for a few seconds, or
until another event takes place), without interrupting the
execution of the code?

Thanks in advance!
 
Here is one I found in the archives
http://tinyurl.com/qgdb
Sub TimedMessage()
Const Title As String = "Self closing message box"
Const Delay As Byte = 2 ' Tps d'affichage en secondes
Const wButtons As Integer = 16 ' Boutons + icone
Dim wsh As Object, msg As String
Set wsh = CreateObject("WScript.Shell")
msg = Space(10) & "Bonjour," & vbLf & vbLf & "Nous sommes le " & Date
wsh.Popup msg, Delay, Title, wButtons
Set wsh = Nothing
End Sub
 
Here's a link that discusses some options.
http://www.google.com/groups?num=50...UTF-8&oe=UTF-8&safe=off&q=&btnG=Google+Search

===========================================================================

Sub DisplayMessageWScript()
'' Display a MsgBox for two seconds.

Dim intSec As Integer
Dim WshShell2 As Object
Dim strText As String, strTitle As String

intSec = 2
strTitle = "PopUp Message"
strText = "Displays for " & intSec & " second."

Set WshShell2 = CreateObject("WScript.Shell")
WshShell2.Popup strText, intSec, strTitle

End Sub

===========================================================================

Sub DisplayMessageWSH()
'' Set a reference to "Windows Script Host Object Model"

Dim SH As IWshRuntimeLibrary.WshShell

Set SH = New IWshRuntimeLibrary.WshShell
SH.Popup "Hello World", 5, "Title", vbYesNo

End Sub

===========================================================================

Watch for linewrap here. Just call this routine with the string that
you wish to display.

Sub DisplayTextBox(strShow As String)
'' Displays a text box for a given amount of time.

Dim intLen As Integer
Dim shpTB As Shape

Application.ScreenUpdating = True

intLen = Len(strShow)

Set shpTB =
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 0, 0, 140,
15)
With shpTB
.Top = ActiveWindow.VisibleRange.Top + 250
.Left = ActiveWindow.VisibleRange.Left + 350
.Width = intLen * 5
.Fill.ForeColor.SchemeColor = 8
With .TextFrame.Characters
.Text = strShow
With .Font
.ColorIndex = 4
.FontStyle = "Bold Italic"
.Size = 9
End With
End With
End With

Application.Wait (Now + TimeValue("0:00:03"))

shpTB.Delete

End Sub

HTH
Paul
 
Back
Top