>Hi All,
>
>I have an app that automates Word. From time to time my users exit prematurely and the leaves an instance of Word running on the PC. On the next start up of the application they get two instances of Word running. Any ideas on how I can check for multiple instances of Word and possible kill one of them off?
>
>Regards
>
>Paul Robinshaw
Paul,
You could use the GetObject function instead of CreateObject. CreateObject creats a new sinatnce everytime where GetObject grabs an already existing instance (if one exists).
Try the following:
local llerror
llerror = .F.
lcerror = on('error')
on error *
oWord = GetObject(,"word.application")
if vartype(oWord) = "O" then
else
oWord = createobject("word.application")
endif
if !empty(lcerror) then
on error &lcerror
endif
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao