+ Reply to Thread
Results 1 to 16 of 16

API Calls to replace SendKeys{TAB} function

  1. #1
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    API Calls to replace SendKeys{TAB} function

    Hello All

    I desperately need your help in this. In my company earlier we were using Windows XP(Excel 2007) and the VbA code that I had written in excel used to work perfectly fine with SendKeys{TAB} statements. But now we are moved to Windows 7(Excel 2010) and this doesn't work anymore and sometime NUMLOCK automatically turns off too.

    Can we use API Call to solve this problem?

    Hope any of you can help me out.

    Thanks

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: API Calls to replace SendKeys{TAB} function

    You'll need to give us a bit more than that.

    What was this send keys doing? Do you have any experience using windows apis?

    Also, please post your code

  3. #3
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: API Calls to replace SendKeys{TAB} function

    Thanks Kyle, I have been using SendKeys{TAB} command many time in one project. So Now I need to replace it with API . The below is one example where SendKeys{TAB} is used but there are lots of functions where I'm using SendKeys{TAB} command.There are so many controls in the form that I'm making visible and invisible one after another to record data about the batches.
    Please Login or Register  to view this content.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: API Calls to replace SendKeys{TAB} function

    What's the tab supposed to do? Can't you just use SetFocus. I see no need for APIs?

  5. #5
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: API Calls to replace SendKeys{TAB} function

    Tab is moving focus to controls. I can't use set focus because there are so many controls in one form and they are not visible all together. First one control becomes visible and ask user to input the data and then another one gets visible so my manager asked me to use APIs to replace SendKeys{TAB} commands.

  6. #6
    Forum Contributor
    Join Date
    09-03-2015
    Location
    IE
    MS-Off Ver
    2003 - 2016
    Posts
    258

    Re: API Calls to replace SendKeys{TAB} function

    NUMLOCK automatically turns off too
    See http://www.ozgrid.com/forum/showthread.php?t=192625

    Same code can be used to send a TAB with a little change...

  7. #7
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: API Calls to replace SendKeys{TAB} function

    Don't use either. You should be using SetFocus, as in
    Please Login or Register  to view this content.

  8. #8
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: API Calls to replace SendKeys{TAB} function

    Quote Originally Posted by aman1234 View Post
    Tab is moving focus to controls. I can't use set focus because there are so many controls in one form and they are not visible all together. First one control becomes visible and ask user to input the data and then another one gets visible so my manager asked me to use APIs to replace SendKeys{TAB} commands.
    So make it visible, then setfocus.

  9. #9
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: API Calls to replace SendKeys{TAB} function

    Kyle, Its very difficult to explain you why I don't want to use setfocus. There are way to many controls and lots of conditions in the back . I have used SendKeys{TAB} too many times in the code so just want to replace it using API call function . I don't want to make the controls visible or invisible and use setfocus as suggested as suggested by my boss.
    I really like the link that grimes0332 shared in this thread. Can anyone please help me how to use TAB in that code. So replacing SendKeys{TAB} with APIs.

    Kyle, sorry can't upload my excel workbook due to security restrictions in my company but setfocus wont work here. Would really appreciate if you can suggest some other way to this.

    Many Thanks

  10. #10
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: API Calls to replace SendKeys{TAB} function

    Added tab:
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: API Calls to replace SendKeys{TAB} function

    Thanks Kyle, Is it the API function?

  12. #12
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: API Calls to replace SendKeys{TAB} function

    Kyle Many Thanks for your help so far. Can you pls tell me What is the difference between using SendKeys{TAB} and using this to press TAB?

  13. #13
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: API Calls to replace SendKeys{TAB} function

    Quote Originally Posted by aman1234 View Post
    I really like the link that grimes0332 shared in this thread. Can anyone please help me how to use TAB in that code. So replacing SendKeys{TAB} with APIs.
    You said that's what you wanted?

    What's the difference? Nowt I reckon - they're equally bad

  14. #14
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: API Calls to replace SendKeys{TAB} function

    Just wanted to double check is it the API call ?

  15. #15
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: API Calls to replace SendKeys{TAB} function

    It's an API call, there's no such thing as the API call. An API call in this context is just calling one of many functions built into the windows operating system

  16. #16
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: API Calls to replace SendKeys{TAB} function

    This is exactly what I was looking for. Thanks so much Kyle.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Function that calls other functions
    By chipp300 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-16-2014, 08:03 PM
  2. reset function calls
    By kbka in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2014, 09:00 AM
  3. Macro that calls List function
    By Lynn Porter in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-09-2013, 06:31 PM
  4. [SOLVED] Question about multiple function calls
    By Zerex71 in forum Excel General
    Replies: 2
    Last Post: 08-03-2006, 09:30 AM
  5. [SOLVED] Using ODBC function calls
    By Dave in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-15-2006, 10:40 AM
  6. SendKeys function
    By moglione1 in forum Excel General
    Replies: 1
    Last Post: 11-07-2005, 11:00 AM
  7. [SOLVED] VBA: How to pass arrays in Function Calls?
    By Mac Lingo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-01-2005, 04:09 PM

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