VB 6.0 Sendkey Controls

Click Star to Rate Post
1 Star2 Stars3 Stars4 Stars5 Stars (10 votes, average: 3.90 out of 5)
 

The following key codes work for Visual Basic 6.0 and older for using Sendkeys


^ = Control

{enter} = Enter/Return Key

% = Alt

{Del} = Delete Key

{ESCAPE} = Escape Key

{TAB} = Tab

+ = Shift Key

{BACKSPACE} = Backspace

{BREAK} = Break

{CAPSLOCK} = Caps Lock

{CLEAR} = Clear

{DELETE} = Delete

{DOWN} = Down Arrow

{LEFT} = Left Arrow

{RIGHT} = Right Arrow

{UP} = Up Arrow

{NUMLOCK} = Num Lock

{PGDN} = Page Down

{PGUP} = Page Up

{SCROLLLOCK} = Scroll Lock

{F1} = F1 .......Use {F2} {F3} and so on for others...

{HOME} = Home

{INSERT} = Insert

Revised: 2015

7 thoughts on “VB 6.0 Sendkey Controls

  1. Jason Post author

    Hi, the purpose of the post is reference only, NOT how to literally USE THE sendkey command but on WHICH sendkeys are available.

    Using the Sendkey command is easy anyways.

    —————————————–

    Dim hWnd As Long

    hWnd = Shell(“notepad”, vbNormalFocus)

    AppActivate hWnd

    SendKeys “I’m sending Keystrokes!”, True

    —————————————–

    That code will open the notepad app and send the specified message using sendkeys.

    Sorry you didn’t like the post, but it is for a reference and NOT how to do Sendkeys in General.

    Jason

    Reply
  2. DH

    1: That should be {CAPSLOCK} not {CAPLOCKS}
    2: For some reason {SCROLLLOCK}, {CAPSLOCK} and {NUMLOCK} won’t work on my PC. Any idea why?

    Reply
  3. Jason Post author

    Hi, thanks for letting me know about the misspell.

    I also noticed that numlock and such would not work when I tried a while back. I never did research or anything to find out why. If I remember correctly I also tried with VB.NET and still didn’t work?

    If I find out I will post the reason. If you find out let me know know as well. 🙂

    Jason

    Reply
  4. uSAMA

    i am sending command

    Sendkeys (“{F4}”)

    MESSAGE SHOW PREMISSION DENIED

    TELL ME SOLUTION FOR SENDING KEYS

    Reply
  5. Jason Post author

    What OS are you using for sending keys? If your running Vista or Win7 then you probably need Administration Approval first since both of those oses has UAC in the os kernel.

    Reply

Leave a Reply

Your email address will not be published.