?
Solved

VB sendkey is not working if focus is lost

Posted on 2003-11-04
7
Medium Priority
?
988 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 750 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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month11 days, 9 hours left to enroll

752 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