Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Right Arrow Key 2

Status
Not open for further replies.

M626

Programmer
Mar 13, 2002
299
Does anyone know how to send the Rigt Arrow Command using SendKeys or anyother method to do this?
 
Try this

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)

Private Const VK_RIGHT = &H27

Private Sub Command1_Click()
keybd_event VK_RIGHT, 0, 0, 0
keybd_event VK_RIGHT, 0, KEYEVENTF_KEYUP, 0
End Sub If you choose to battle wits with the witless be prepared to lose.
[machinegun][hammer]

[cheers]
 

This should do it:
Sendkeys("{RIGHT}") Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Sorry I forgot the constant. You will also need to make sure the focus is in the right place. Drop a command button and a textbox on a form then add this code

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)

Private Const VK_RIGHT = &H27
Private Const KEYEVENTF_KEYUP = &H2

Private Sub Command1_Click()
Text1.SetFocus
keybd_event VK_RIGHT, 0, 0, 0
keybd_event VK_RIGHT, 0, KEYEVENTF_KEYUP, 0
End Sub

Sorry about that, I guess I am still waking up. [spin] If you choose to battle wits with the witless be prepared to lose.
[machinegun][hammer]

[cheers]
 
SendKeys "{DOWN}", True

True means keystrokes must be processed before control is returned to the procedure.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top