Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Why does sendkeys seem to loop
When a user types the space bar, I want 1 space, but if they type
<Ctrl+space I want to insert 5 spaces where the cursor is in the text box (sort of simulating a tab, but I want to keep the tab key for moving focus from this control to the next). If the message box line is commented out, spaces keep getting added in what seems like an endless loop. If the message box line us uncommented and allowed to execute, then 5 spaces are added along with the original space making a total of 6 (1 space too many). If I change the keycode = 32 to keycode = 188 (a comma, I think) then the correct number of spaces is added and there is no ",". How can I fix this? Thanks, Geoff Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) If KeyCode = 32 And Shift = 2 Then 'MsgBox "Both the <ctrl key and <spc key were pressed" SendKeys " ", False 'inserts 5 spaces End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
sendkeys string | Excel Discussion (Misc queries) | |||
How Can I Use SendKeys in MAC EXCEL? | Excel Programming | |||
Sendkeys | Excel Programming | |||
SendKeys | Excel Programming | |||
sendkeys | Excel Programming |