Excel VBA application.wait method is similar to sleep

Source: Internet
Author: User

1. This case will pop up MsgBox at six o'clock.

Sub test01 () If application.wait ("6:00:00") then MsgBox "Now time Six o'clock full" ' This is the system time End IfEnd Sub

2.10 seconds after executing this macro, the MsgBox pops up.

sub test02 () Newhour = hour (now ())  newminute = minute (now ()) newsecond =  second (now ())  + 10waittime = timeserial (Newhour, newminute, newsecond) If  Application.Wait waitTime Then MsgBox  "time passed 10 seconds"   end ifend sub 

3.10 seconds after executing this macro, the MsgBox pops up.

Sub test03 () If application.wait (now + timevalue ("0:00:10")) then ' feels simpler than test02 MsgBox ' Time passed 10 seconds ' End IfEnd Sub


Excel VBA application.wait method is similar to sleep

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.