Hallo,
die Shell zickt da häufiger, probiers mit API, Einst. auf 5 sec im Code zu ändern:
Option Explicit
Private Declare PtrSafe Function MessageBoxTimeoutA Lib "user32.dll" ( _
ByVal hWnd As LongPtr, _
ByVal lpText As String, _
ByVal lpCation As String, _
ByVal uType As VbMsgBoxStyle, _
ByVal wLanguageId As Integer, _
ByVal dwMiliseconds As Long) As Long
Private Declare PtrSafe Function FindWindowA Lib "user32.dll" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As LongPtr
Private Const MB_TIMEOUT As Long = &H7D00
Private Const GC_CLASSNAMEMSOUTLOOK As String = "rctrl_renwnd32"
Public Sub test()
Dim lngReturn As Long
Dim lngptrHwnd As Long
lngptrHwnd = FindWindowA(GC_CLASSNAMEMSOUTLOOK, Application.ActiveExplorer.Caption)
lngReturn = MessageBoxTimeoutA(lngptrHwnd, "Hallo", _
"TimeoutTest", vbYesNo Or vbInformation, 0, 5000) '///<<<< 5000 = 5 Sekunden hier bB ändern....
Select Case lngReturn
Case MB_TIMEOUT
Debug.Print "TimeOut"
Case vbOK, vbYes
Debug.Print "Ok, Ja"
Case vbAbort, vbCancel
Debug.Print "Abrechen"
Case vbNo
Debug.Print "Nein"
Case vbRetry
Debug.Print "Wiederholen"
Case Else
Debug.Print lngReturn
End Select
End Sub
Gruß,
|