LPARAMETERS tcFile LOCAL llReturn, lnHandle, lnHwnd llReturn = .T. IF NOT EMPTY(SYS(2000,m.tcFile)) && File does exist lnHandle = FOPEN(m.tcFile, 12) IF m.lnHandle < 0 =MESSAGEBOX('This file is already opened. Please close Excel...', 0, "File is opened") DECLARE Sleep IN kernel32 INTEGER dwMilliseconds DECLARE INTEGER FindWindow IN user32; STRING lpClassName, STRING lpWindowName lnHwnd = FindWindow(Null, "Microsoft Excel - " + JUSTFNAME(m.tcFile)) IF m.lnHwnd > 0 DECLARE INTEGER ShowWindow IN user32 AS ShowWindowA ; INTEGER hWindow, INTEGER nCmdShow DECLARE SHORT BringWindowToTop IN WIN32API ; INTEGER hWnd DECLARE SHORT SetForegroundWindow IN WIN32API ; INTEGER hWnd =BringWindowToTop(m.lnHwnd) =ShowWindow(m.lnHwnd,1) ENDIF * I close Excel and see this bad effect Sleep(1000*10) && Hopefully 10 sec. would be enough to save and close Excel lnHandle = FOPEN(m.tcFile, 12) IF m.lnHandle < 0 && Still opened =MESSAGEBOX("Please try again...",0,"File is opened") llReturn = .F. ELSE FCLOSE(m.lnHandle) ENDIF ELSE FCLOSE(m.lnHandle) ENDIF ENDIF RETURN m.llReturnIt works almost fine except that after I press Close button on Excel, the image of it is still keeping around for some time.