タイトル : Re^13: DoEventsの挙動 投稿日 : 2010/01/28(Thu) 16:50 投稿者 : GOD
DoEvents の挙動で一つ思い出したのですが、DoEvents 中に 再度 DoEvents を行うと、 2回目の処理が終了しないと1回目の DoEvents には復帰しないようです。 ぽると さんのプログラムで DoEvents 中に DoEvents することはありませんか? 例.↓のサンプルでボタン1クリックの5秒後にボタン2クリック Private Sub Command1_Click() Dim dt As Date dt = Now Debug.Print "Command1_Click in:" & Now Do DoEvents Loop While DateDiff("s", dt, Now) < 10 Debug.Print "Command1_Click out" & Now End Sub Private Sub Command2_Click() Dim dt As Date dt = Now Debug.Print "Command2_Click in:" & Now Do DoEvents Loop While DateDiff("s", dt, Now) < 10 Debug.Print "Command2_Click out" & Now End Sub 結果として Command1_Click in:2010/01/28 16:30:05 Command2_Click in:2010/01/28 16:30:10 Command2_Click out2010/01/28 16:30:20 <--- 10秒経過 Command1_Click out2010/01/28 16:30:20 <--- 15秒経過 となります。 |