Solved

VB sendkey is not working if focus is lost

Posted on 2003-11-04
7
985 Views
Last Modified: 2008-01-09
hi,

                    My question is about VB "sendkeys". Its working properly if focus remains in the application. But if focus is lost (say a dialog box has been appeared on the screen ". how can I handle the problem.

thanks.
dotcdotc
0
Comment
Question by:dotcdotc
[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
  • 3
  • 2
7 Comments
 
LVL 48

Expert Comment

by:Mikal613
ID: 9678728
Use the Function AppActivate which you just pass the name of the app.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9679013
AppActivate works if there is no dialog box that belongs to target appliaction in screen cause when you use AppActivate, VB activates the foremost window.
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 250 total points
ID: 9679023
If you really needs to send key to a non-focus app, use SendMessage  or Keyboard_event APIs.
Cheers
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 10471561
Ups!, where is the split thing?
0

Featured Post

Industry Leaders: 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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

717 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