宣言はこちら
Private Declare PtrSafe Function CustomTimeOffMsgBox Lib "user32" Alias "MessageBoxTimeoutA" ( _ ByVal xHwnd As LongPtr, _ ByVal xText As String, _ ByVal xCaption As String, _ ByVal xMsgBoxStyle As VbMsgBoxStyle, _ ByVal xwlange As Long, _ ByVal xTimeOut As Long) _ As Long
使い方
If CustomTimeOffMsgBox(0, "キャンセルボタンを押さないと5秒後に処理が動作します。", "カウントダウン", vbInformation + vbOKCancel, 0, 5000) = vbCancel Then 'Cancel Else 'ここに処理書く End If