?
Solved

Regain Focus After Shell Call

Posted on 2003-02-26
2
Medium Priority
?
610 Views
Last Modified: 2012-05-04
I have a VBA event that calls a proprietary query program to gather information, then send it to Excel. Since the Query program Opens Excel, Access loses focus and will error if I don't click on Form Icon in taskbar, to regain focus to Access, after Excel opens and before sleep timer expires.

The following is semi-pseudo code of what I am Doing:

PRG_ID = Shell(Query_Program,6)

Sleep (15000)

Set ObjExcel = GetObject(, "excel.application")
ObjExcel.Application.Visible = False
ObjExcel.Application.DisplayAlerts = False
ObjExcel.Activeworkbook.Save
ObjExcel.Quit


Any Thought???

Thanks
0
Comment
Question by:muzak
[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
2 Comments
 
LVL 5

Accepted Solution

by:
JohnMcCann earned 300 total points
ID: 8029645
Have you tried

Private Declare Function Putfocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long

I assume it would work some thing like this

WinHandle = application.hWndAccessApp
PRG_ID = Shell(Query_Program,6)
Putfocus WinHandle
0
 

Author Comment

by:muzak
ID: 8029697
Mission Accomplished!!

Thanks....
0

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

741 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