Any example with CreateWaitableTimer SetWaitableTimer

onidarbe

Board Regular
Joined
Mar 22, 2013
Messages
65
I'm trying to construct a OnTime in milliseconds that keeps running after a debug break-mode.

- Application.OnTime gives "Can't execute code in break mode" !
- Using the API SetTimer in "user32" gives a fatal error when it is calling a sub while you are in break-mode!
- SetCoalescableTimer would probably solve it with the uToleranceDelay, but it is only for Windows 8, I got 7 64x :(

But I've found something here in French! using CreateWaitableTimer SetWaitableTimer. Maybe this is something, but it is written in a class which I would love to see working in a compact module-vba-code.

So if anyone has some example code for a timer that can continue after a break-mode, please let me know...

thanks,
Michel
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
I know it's an old question, but the solution is for all still seeking it, to use apostrophes around the procedure and add at least 1 parameter. This way there is no error "Can't execute code in break mode". It will just execute after all running VBA code has ended and not editing a cell and no MsgBox is up.
Code:
Application.OnTime now, "[B]'[/B]MySub """ & textPar & """[B]'[/B]"
Sub MySub (optional xPar)
End Sub
 
Upvote 0
Another 2 years.

well done onidarbe, thats a good find about OnTime.
I have checked it out with 64 bit Excel 2013 vba and it works for me.

For others reading this, I found a good description that explained the argument syntax at
http://markrowlinson.co.uk/articles.php?id=10

Also, this is the only post I have found that says 64bit crashes with SetTimer when in break mode. That is a problem I am presently struggling with.

My question for onidarbe (if its not too late):
You said you wanted to get OnTime working with msec. Did you have any joy? From my reading and checks, I thought it was not possible. I am chasing a 100 msec delay - any suggestions?

thanks
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

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