vba touch screen status windows 8

david0

New Member
Joined
Jul 23, 2014
Messages
5
I have an excel sheet using VBA macro to execute tasks in a loop. Code is below. It is launched by clicking a shape that has the macro assigned. The loop executes at least once, and repeats so long as the mouse button is held down.
This method works fine for mouse, for touchpad on a physical keyboard (requires double-tap and hold to keep looping). On a tablet with windows 8, and excel 2013 it works with a stylus, seems just the same as the touchpad. It does not work the same with a finger touch (only executes once with brief touch). Holding a finger touch turns into right click after 2 seconds. If I lock the sheet and object, then the prolonged touch does not turn into right click so no big problem there. If I do a double touch and hold then the right click does not even eventuate at all.
I figure that I only need a simple method to detect a finger touching the screen to keep this loop going like it does with a long mouse click, or more likely the same behaviour as the touchpad and stylus. I have not been able to find the API? method to read the touch screen status. I am not experienced in VBA or API. I know that my approach to this repeating loop is not an event-driven approach which is how VBA works most, but it is not very different to how scrollbars work in excel. I am wanting to use large shapes rather than scrollbar because I find that the scrollbar is too hard to click and many of the users for this sheet will be ham-fisted.
Can anybody tell how to achieve this asynchronous detection of touch status in VBA?

<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; white-space: inherit; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">First = TrueDo While GetAsyncKeyState(vbKeyLButton) Or First DoEvents: 'do stuff here First = False Sleep LoopDelayTimeLoop</code></pre>
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,598
Messages
5,832,646
Members
430,150
Latest member
amitk1

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
Top