Hi Yuri,
Works with Word as well, but the enumerated constant is a numeric with objWord.DisplayAlerts=0 meaning show no alerts.
>Sometimes I need to close unconditionally all running Excel or Word applications on the remote server. I do it as described in
http://support.microsoft.com/support/kb/articles/Q246/0/21.ASP, like:
>*------------------------
>DECLARE LONG FindWindowA IN WIN32API STRING class, STRING title
>DECLARE INTEGER SendMessage IN Win32API ;
> INTEGER HWND,INTEGER Msg, Short WParam, INTEGER LPARAM
>
>* Pass the class name for Excel - "XLMain" to FindWindowA
>lcMSClassName="XLMain"
>
>oWordHandle = FindWindowA(lcMSClassName,NULL)
>do while oWordHandle>0
> =SendMessage(oWordHandle,16,0,0)
> oWordHandle = FindWindowA(lcMSClassName,NULL)
>enddo
>*----------------------------
>The problem is when changes were made on particular file, the messagebox appears asking for "do you want to save..." and waiting for response.
>In all my applications I use objExcel.DisplayAlerts=.f. to avoid it, but I can not figure out how to control others.
>I will appreciate your help.
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05