?
Solved

SendKeys Skipping the first send

Posted on 1999-01-20
5
Medium Priority
?
169 Views
Last Modified: 2012-05-04
This is the first part of my program.  The first TAB will not function. There are other TABs in the program that do work. I have tried putting a timer after the App is Activated.

Private Sub Command1_Click()
    AppActivate "Merchant Management", True
    SendKeys "{tab}", True
    SendKeys "E", True
0
Comment
Question by:matthewkwp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 4

Accepted Solution

by:
chabaud earned 300 total points
ID: 1469673
Try this alternate code (which send Alt+E):

AppActivate "Merchant Management", True
SendKeys "%E", True
0
 
LVL 3

Expert Comment

by:sduckett
ID: 1469674
I've tested very similar code using Word instead of your app as I don't have "Merchant Management".
The code works, but it does depend on the state of the App at the time the code is run. eg. If the cursor is in a document at the time it runs a tab is placed there, if a dialog box is open, a tab is sent to that dialog box.
Can you be confident that the app is in the state you expect at all times? What actually happens if you switch to Merchant Management and press 'tab'?

0
 
LVL 12

Expert Comment

by:mark2150
ID: 1469675
Yeah, SendKeys tends to be state dependent. You're much safer sending explicit Ctrl-this, Alt-that's than assuming that "two tabs" are going to activate some function.

M

0
 

Author Comment

by:matthewkwp
ID: 1469676
Alt/Ctrl won't work.  I also tried this in a 'Notepad' Window and had the same results.
0
 
LVL 4

Expert Comment

by:chabaud
ID: 1469677
Try insert DoEvents statement between your SendKeys.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question