You can try this MsgboxTimeout function in conjunction with a timer to do this job.
Place a command button (Command1) and a timer (Timer1) on your form containing the following code. Run and test the program to see the message box vanish automatically.
___
Option Explicit
Private Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
Private Sub Command1_Click()
Debug.Print MsgboxTimeout("This message box will automatically dismiss in 5 seconds!", vbExclamation, "Message box with timeout", 5000)
End Sub
Function MsgboxTimeout(Prompt As String, Optional Buttons As VbMsgBoxStyle, Optional Title As String, Optional TimeoutMilliSeconds As Long) As VbMsgBoxResult
If Title = vbNullString Then Title = App.Title
Timer1.Tag = Title
Timer1.Interval = TimeoutMilliSeconds
Timer1.Enabled = True
MsgboxTimeout = MessageBox(hwnd, Prompt, Title & Chr$(160), Buttons)
If Timer1.Tag = vbNullString Then MsgboxTimeout = 0 'indicates a timeout dismissal
Timer1.Enabled = False
End Function
Private Sub Timer1_Timer()
AppActivate Timer1.Tag & Chr$(160)
Timer1.Tag = vbNullString
SendKeys " "
End Sub