>I have a program that opens an Excel spreadsheet and reads some data from it. I know I can keep the instance of Excel invisible, but I would actually like to keep it visible. However, once I set Excel as visible, it gets focus. I can't figure out how to get back to VFP (apart from manually clicking on VFP on the task bar). Is there a way to programmatically force focus back to my VFP application?
>
>Joel
Try:
DECLARE INTEGER SetForegroundWindow IN WIN32API INTEGER
oExcel = CREATEOBJECT([Excel.Application])
oExcel.Visible = .t.
SetForegroundWindow(_screen.HWnd)
WAIT WINDOW [aaa]
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.