+ Reply to Thread
Results 1 to 8 of 8

How to make SendKeys "{TAB}" wok correctly

  1. #1
    Registered User
    Join Date
    10-24-2012
    Location
    Costa Rica
    MS-Off Ver
    Excel 2003
    Posts
    10

    How to make SendKeys "{TAB}" wok correctly

    Hello all,

    This is what I want to do:

    There is a webpage that we use all the time, it is internal. Inside that webpage you have a list of items with check boxes, everytime you work a ticket you have to choose just one of those items. For some reason the programmers setup this list in such way that, by default, all items are checked, so we have to go one by one unchecking all items and just leave the one we want. I know they will take a WHILE to fix that so I created a macro to uncheck all boxes.

    The problem with this macro is that it requires a lot of "tabs" so it goes crazy if I don't slow it down...

    Here is the code:

    Public Sub Remove_checks()

    Dim ie As Object
    Set ie = CreateObject("internetexplorer.application")

    ie.Visible = True

    ie.navigate Range("B4").Value

    Application.Wait (Now + TimeValue("0:00:5"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    SendKeys "( )", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    SendKeys "( )", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    SendKeys "( )", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    SendKeys "( )", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    SendKeys "( )", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    SendKeys "( )", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    SendKeys "( )", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    SendKeys "( )", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    Application.Wait (Now + TimeValue("0:00:1"))
    SendKeys "{TAB}", True
    SendKeys "( )", True



    End Sub

  2. #2
    Registered User
    Join Date
    10-24-2012
    Location
    Costa Rica
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: How to make SendKeys "{TAB}" wok correctly

    I had put one second in between each "tab", otherwise it will go anywhere in the page.

    Thanks in advance for your help.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: How to make SendKeys "{TAB}" wok correctly

    This could be done without the notoriously flaky SendKeys.

    What exactly is it you have on the page?

    Is it separate checkboxes? A list of items with a checkbox next to each?
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    10-24-2012
    Location
    Costa Rica
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: How to make SendKeys "{TAB}" wok correctly

    Correct, A list of items with a checkbox next to each. The are all checked and I want to uncheck them.

  5. #5
    Registered User
    Join Date
    10-24-2012
    Location
    Costa Rica
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: How to make SendKeys "{TAB}" wok correctly

    Doe anyone have any idea?

  6. #6
    Registered User
    Join Date
    10-24-2012
    Location
    Costa Rica
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: How to make SendKeys "{TAB}" wok correctly

    Looks like there is no way to fix it... I'll close the thready tomorrow... Thanks anyways

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: How to make SendKeys "{TAB}" wok correctly

    Sorry, I meant to get back to you but been having some laptop woes.

    Anyway, what I was going to say is that it is probably possible to do this without SendKeys but
    I think we would need to see a URL or some source code.

    The URL would be best.

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: How to make SendKeys "{TAB}" wok correctly

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    HTH
    Regards, Jeff

+ 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