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>
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Watch MrExcel Video

Forum statistics

Threads
1,108,790
Messages
5,524,893
Members
409,609
Latest member
Channingz

This Week's Hot Topics

Top