How can i add a 500 ms delay

mtheriault2000

Well-known Member
Joined
Oct 23, 2008
Messages
826
Hello

I'm doing a screen capture with Hypersnap, but Excel is to fast. How can i add a 500ms delay before looking for the new created file. Screen is captured then a new file is created. Problem, i always get the previous file because Excel is faster than the captured software.

Or, should i loop in the directory until the file exist?

Martin
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Try this - it will give a 1 second delay

Code:
Application.Wait Now + TimeSerial(0, 0, 1)
 
Upvote 0
Hi Martin

If you want a 500ms delay then you can use the Sleep API function:

Code:
'at the top of a standard module:

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

'in your sub:

'...whatever previous code...

Sleep 500   'ie 500 milliseconds

'continue with sub...
 
Upvote 0
Thank you VOG / Richard

Vog, 1 sec is too long. Richard solution is what i was looking for.


Have a great day

Martin
 
Upvote 0

Forum statistics

Threads
1,203,075
Messages
6,053,393
Members
444,661
Latest member
liamoohay

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top