Results 1 to 4 of 4

Thread: Sendkeys Statement vs Method ?

  1. #1
    New Member
    Join Date
    Sep 2007

    Default Sendkeys Statement vs Method ?

    There is a SendKeys statement in VBA, and also an Application.SendKeys method. They both seem to do the same thing. Does anybody know of any differences between the two? Curious why the redundancy exists...

  2. #2
    MrExcel MVP
    xenou's Avatar
    Join Date
    Mar 2007
    Clev. OH, USA

    Default Re: Sendkeys Statement vs Method ?

    I can't seem to find any difference between the two - they seem to behave interchangeably in a few tests but I haven't subject it to much testing either. -- Alex

    Using: Office 2010/Win7 (work) Office 2010/Win7 (home)

    You are rich in proportion to the number of things you can let alone.
    -- Henry David Thoreau

  3. #3
    MrExcel MVP Joe Was's Avatar
    Join Date
    Feb 2002
    Central Florida, USA

    Default Re: Sendkeys Statement vs Method ?

    The SendKey Statement sends the command to the Active Window!

    The SendKeys Method sends the commands to the Active Application, which may be different than the active window!

    But, they work the same and in most situations they are interchangable, the difference is when you are controling one application from another, rather that working within one application.

    They are not "Redundant" and they do have different uses!
    JSW: Try and try again: "The way of the Coder!"

  4. #4
    New Member
    Join Date
    Nov 2008

    Default Re: Sendkeys Statement vs Method ?

    Also remember that if your using Sendkeys that you cannot step in the VBA editor or you will send the sendkeys to the VBA editor instead of the intended application.
    Below is an example I used for Internet explorer. It sends a Alt+Y.

    AppActivate IEDoc
    SendKeys "%Y"

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts