Link to home
Start Free TrialLog in
Avatar of muzak
muzak

asked on

Regain Focus After Shell Call

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
ASKER CERTIFIED SOLUTION
Avatar of JohnMcCann
JohnMcCann

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of muzak
muzak

ASKER

Mission Accomplished!!

Thanks....