掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
モーダルフォーム (ID:78205)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
MsgBoxの表示中でも、Timerイベントは発生しますので、注意してください。 (開発環境では発生しませんが) さて、『MsgBox関数を表示させているかどうか』の判定方法ですが、 一つの案として、「MsgBox関数自体をカスタマイズする」という 手法があります。 例えば、後述のコードを標準モジュールに書いておけば、 Timerイベント側では、 Private Sub Timer1_Timer() If gbolIsMsgBoxVisible = True Then 'メッセージボックス表示中 Else 'メッセージボックスは表示されていない End If End Sub のようにして判定することができます。 Public gbolIsMsgBoxVisible As Boolean Public Function MsgBox(ByVal Prompt As String, _ Optional ByVal Buttons As VbMsgBoxStyle = vbOKOnly, _ Optional ByVal Title As Variant, _ Optional ByVal HelpFile As Variant, _ Optional ByVal Context As Variant) As VbMsgBoxResult If IsMissing(Title) Then Title = App.Title End If gbolIsMsgBoxVisible = True If IsMissing(HelpFile) Or IsMissing(Context) Then MsgBox = VBA.MsgBox(Prompt, Buttons, Title) Else MsgBox = VBA.MsgBox(Prompt, Buttons, Title, HelpFile, Context) End If gbolIsMsgBoxVisible = False End Function
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.