I want a timer type of property for message boxes. After displaying error, it must disappear without user intervention after 5 seconds.
Application.ApplicationExit += new EventHandler ( Application_Exit ); Alternatively, if you have a handle to the MessageBox window, you could send the MessageBox window a WM_CLOSE message. (You can obtain the handle to the MessageBox window using FindWindow.)
Sub MessageBoxTimer () Dim AckTime As Integer, InfoBox As Object Set InfoBox = CreateObject ("WScript.Shell") 'Set the message box to close after 10 seconds AckTime = 10 Select Case InfoBox.Popup ("Click OK (this window closes automatically after 10 seconds).", _ AckTime, "This is your Message Box", 0) Case 1, -1 Exit Sub End Select End Sub
ActiveCell.Offset(0, 1).Select ActiveCell.Value = CustomerProblem Sheets("sheet1").Select Range("C4").Select Msgbox "Record Updated " should be showed & hide at once (Without clicking ok) End Sub This thread is locked.
If no one clicks a button within 10 seconds, the message box will automatically dismiss itself. Message box title. Message box type: a message box with Yes and No buttons and a question mark icon. When we call the Popup method the message box appears on screen.
timer.Interval=5000;
timer.Enabled=true;
MessageBox.Show("Should close automatically");
Associate the following snippet with the timer's Tick
eventhandler:
private void timer_Tick(object sender,EventArgs evt) {
timer.Enabled=false;
SendKeys.Send("{ESC}"); // SendWait as alternative
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With