+ Reply to Thread
Results 1 to 12 of 12

SendKeys

  1. #1
    Registered User
    Join Date
    10-03-2004
    Posts
    70

    SendKeys

    I want to switch on Caps & Number lock on opening an Excel document. I'm using the following code;

    Please Login or Register  to view this content.
    But nothing happens on opening. Where am I going wrong?

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: SendKeys

    here's some code
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: SendKeys

    I was pondering why OT's code didn't work; and then it occurred to me that Caps Lock and Num Lock never make it out of the keyboard driver -- Excel wouldn't know what to do with them.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: SendKeys

    Hello OptionTrader,

    Here is a more succinct version of the API send keys.

    VBA Module Code
    Please Login or Register  to view this content.
    ThisWorkbook_Open Event Code
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 01-17-2010 at 08:10 PM.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Registered User
    Join Date
    10-03-2004
    Posts
    70

    Re: SendKeys

    Thanks guys.

    shg - Funny thing is original SendKeys code works fine in Excel 2007, but not 2003 (I need it to work in 2003).

    Leith - Can't get that code to work.

    Roy - Code works fine for Caps lock. How can I incorporate Num lock into the code ?

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: SendKeys

    Hello OptionTrader,

    When dealing with API calls and most other code, it helps to know what Operating System you have. You should update your profile to include which operating systems you use. Roy's checks your operating system, that why his working. So, I can assume you are not using Windows 2000 through Windows XP.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: SendKeys

    Just searched through the code on another computer & found this
    Please Login or Register  to view this content.
    Last edited by royUK; 01-24-2010 at 01:10 PM.

  8. #8
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: SendKeys

    sorry wrong page


  9. #9
    Registered User
    Join Date
    10-03-2004
    Posts
    70

    Re: SendKeys

    Quote Originally Posted by Leith Ross View Post
    Hello OptionTrader,

    When dealing with API calls and most other code, it helps to know what Operating System you have. You should update your profile to include which operating systems you use. Roy's checks your operating system, that why his working. So, I can assume you are not using Windows 2000 through Windows XP.
    Hi Leith

    The SendKeys code works fine when using Windows7/Excel2007, but not when using XP/Excel 2003. I need the code in the later combination.

    Martin

  10. #10
    Registered User
    Join Date
    10-03-2004
    Posts
    70

    Re: SendKeys

    Roy, is there any chance you could include the code to also switch on the CapsLock? I'd be most grateful.

    Martin

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: SendKeys

    Quote Originally Posted by OptionTrader View Post
    Roy, is there any chance you could include the code to also switch on the CapsLock? I'd be most grateful.

    Martin
    That's in the first code that I posted and in the second

  12. #12
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Re: SendKeys

    THANX
    very useful to me
    Use Code-Tags for showing your code :
    Please mark your question Solved if there has been offered a solution that works fine for you
    If You like solutions provided by anyone, feel free to add reputation using STAR *

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1