1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VBA Sleep

Posted at
Option Explicit
Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Function SleepTest1()
  Dim i                   '// ループカウンタ
  For i = 1 To 5
      '// 1秒停止
      Call Sleep(1000)
      Debug.Print Now
  Next
End Function
Function SleepTest2()
  Dim waitTime As Long
  waitTime = 2
  Call Sleep(waitTime * 1000)
  MsgBox (waitTime & " 秒ストップ")
End Function

用語 備考
VBA7 Excel2010以上
PtrSafe 64 ビット バージョンの Officeで実行する場合必要
Sleep ミリ秒(1秒の1000分の1)単位
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?