Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1096to1100
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

msgbox für 3 sekunden, dann automatisch schließen

msgbox für 3 sekunden, dann automatisch schließen
k
Hallo,
...kann man eine MSGbox 3 Sekunden stehen lassen (Warnung) und dann automatisch schließen ?
Wenn ja wie ?
Gruß und Danke
Kay

7
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Benutzer
Anzeige
AW: msgbox für 3 sekunden, dann automatisch schließen
14.08.2009 14:47:19
Ralf
Hi,
ja, wie, findest du massenhaft im Archiv.
mfg Ralf
Lösung per WScript funktioniert nicht mehr...
14.08.2009 16:56:25
NoNet
Hallo @alle,
im Archiv findet man zwar einige Beispiel-Lösungen, aber die Variante per WSShell.PopUp(...) funktioniert bei mir nicht mehr : Die MsgBox erscheint zwar, wird jedoch nicht mehr automatisch geschlossen ! Hat jemand eine Erklärung dazu ? Bzw.: funktionieren die Codes bei euch noch ?
https://www.herber.de/forum/archiv/580to584/t583731.htm
https://www.herber.de/forum/archiv/468to472/t468924.htm
Ich arbeite übrigens mit Win XP SP3 und Excel 2003, SP3.
Vermutlich verhindert das irgendein MS Security-Update !?!?! - Aber welches !?!?!!
Gruß und Danke, NoNet
Anzeige
Seit umstieg auf Vista
14.08.2009 17:17:04
Tino
Hallo,
gehts bei mir auch nicht mehr, liegt wohl an Windows.
Gruß Tino
@NoNet & Tino
14.08.2009 17:49:33
Jens
Servus
Der Code von K.Rola...
Sub MsgZeit()
Const bytZeit As Byte = 3
Dim objWSH As Object, intMSG As Integer
Set objWSH = CreateObject("WScript.Shell")
intMSG = objWSH.Popup("Ich bin in " & bytZeit & " Sekunden verschwunden!" & Space(10),  _
bytZeit, "gebe bekannt...")
Set objWSH = Nothing
End Sub
...funzt bei mir.
Habe WinXP SP3 (alle Updates bis heute) und XL2003 SP3
Gruß aus dem Sauerland
Jens
@Jens, bei gehts nicht.
14.08.2009 18:30:13
Tino
Hallo,
geht auf aber nicht mehr von alleine zu. :-(
Unter XP (Virtueller PC) funktioniert es.
Gruß Tino
Anzeige
AW: Seit umstieg auf Vista
14.08.2009 18:05:04
Nepumuk
Hallo,
bei mir funktioniert das unter Vista Home und Ultimate mit Excel 2000, 2002, 2003 und 2007.
Gruß
Nepumuk
Notlösung per API
14.08.2009 18:14:48
Nepumuk
Hallo,
so sollte es auf alle Fälle gehen:
' **********************************************************************
' Modul: Modul2 Typ: Allgemeines Modul
' **********************************************************************

Option Explicit

Private Declare Function MessageBox Lib "user32.dll" Alias "MessageBoxA" ( _
    ByVal hWnd As Long, _
    ByVal lpText As String, _
    ByVal lpCaption As String, _
    ByVal wType As Long) As Long
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( _
    ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long
Private Declare Function SetTimer Lib "user32.dll" ( _
    ByVal hWnd As Long, _
    ByVal nIDEvent As Long, _
    ByVal uElapse As Long, _
    ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32.dll" ( _
    ByVal hWnd As Long, _
    ByVal nIDEvent As Long) As Long
Private Declare Function PostMessage Lib "user32.dll" Alias "PostMessageA" ( _
    ByVal hWnd As Long, _
    ByVal wMsg As Long, _
    ByVal wParam As Long, _
    ByRef lParam As Any) As Long

Private Const MB_DEFBUTTON1 = &H0&
Private Const MB_DEFBUTTON2 = &H100&
Private Const MB_DEFBUTTON3 = &H200&
Private Const MB_ICONASTERISK = &H40&
Private Const MB_ICONEXCLAMATION = &H30&
Private Const MB_ICONHAND = &H10&
Private Const MB_ICONINFORMATION = MB_ICONASTERISK
Private Const MB_ICONQUESTION = &H20&
Private Const MB_ICONSTOP = MB_ICONHAND
Private Const MB_OK = &H0&
Private Const MB_OKCANCEL = &H1&
Private Const MB_YESNO = &H4&
Private Const MB_YESNOCANCEL = &H3&
Private Const MB_ABORTRETRYIGNORE = &H2&
Private Const MB_RETRYCANCEL = &H5&

Private Const GC_CLASSNAMEMSEXCEL = "XLMAIN"
Private Const GC_CLASSNAMEMSDIALOGS = "#32770"

Private Const WM_CLOSE = &H10

Private Const strBoxTitle = "Information"

Private lngxlhWnd As Long

Public Sub prcMsgBox_Time2()
    lngxlhWnd = FindWindow(GC_CLASSNAMEMSEXCEL, Application.Caption)
    Call SetTimer(lngxlhWnd, 0&, 2000&, AddressOf prcTimer) '2000 Millisekunden
    Call MessageBox(lngxlhWnd, "Diese Meldung schließt sich selbst.", strBoxTitle, _
        MB_OK Or MB_ICONINFORMATION)
End Sub

Private Sub prcKillBox()
    Call PostMessage(FindWindow(GC_CLASSNAMEMSDIALOGS, strBoxTitle), WM_CLOSE, 0&, 0&)
End Sub

Private Sub prcTimer(ByVal hWnd As Long, ByVal nIDEvent As Long, _
        ByVal uElapse As Long, ByVal lpTimerFunc As Long)

    Call prcKillTimer
    Call prcKillBox
End Sub

Private Sub prcKillTimer()
    Call KillTimer(lngxlhWnd, 0&)
End Sub

Gruß
Nepumuk
Anzeige

30 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige