View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Patrick Penet Patrick Penet is offline
external usenet poster
 
Posts: 14
Default Cannot kill a WINWORD.EXE instanciation - Sorry for reposting ...

No way !
This stupid WINWORD.EXE is still here.

I will search around for some APIs, I think I
remember one was doing the job.

Thanks anyway.

Patrick


"Halim" a écrit dans le message de news: ...
maybe you can do this but i'm not su
Sub CloseWord()
Set WordObj = getobject( , "word.application")
'do your stuff here...
WordObj.quit
End sub

Place that code after exiting word object
--
Regards,

Halim



"Patrick Penet" wrote:

.... but I really want to solve this problem.

Sorry Halim it does not work.
Actually this code is opening a new instance of Word
but not the one wich is embedded in XL.

The problem is : if the user needs to modify the
text of the embedded Word, he first select the
Word object (right click) and then double click
on it.

This will open an instance of Word "inside" Excel.

This is this instance that would not terminate when
closing the workbook.

Thanks anyhow.

Patrick

"Halim" a écrit dans le message de news:
...
Place this code below in a standard module:
code below will open word better if you run 'Initial' once at first.
Public WordObj as Object
Sub Initial()
Set WordObj = createobject("word.application")
WordObj.visible = true
'do your stuff here...
End sub

Then place code below in ThisWorkbook module:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
WordObj.Quit
set WordObj = nothing
End Sub

--
Regards,

Halim



"Patrick Penet" wrote:

Thank you but I need further precisions.

The Word document is inbedded in a workbook
and programmatically I do not intent to act on it.

The user only opens the WB and modifies the
document if he needs and then closes the WB.

The WB is in another instance of Excel and saved
in the Before_Close sub.

Both the WB and the document have small pieces
of code mainly for design and behaviour.

So, at your idea, where should I put the code you
suggested ?

Thank you for answering.
Patrick

"Halim" a écrit dans le message de news:
...
hi,

You have to define your WORD object variable as a public variable

Public WordObj as Object

Sub Initial()
Set WordObj = createobject("word.application")
WordObj.visible = true
'do your stuff here...
End sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
WordObj.Quit
set WordObj = nothing
End Sub

--
Regards,

Halim



"Patrick Penet" wrote:

Hello Gurus,

I have a workbook which includes a Word document.

When, by VBA, the user quits this workbook, once the
Word document is edited, and returns into my app,
an instance of WINWORD is remaining active in the
tasks manager.

And more, even if the user leaves the application, this
WINWORD.EXE remains active and raises a problem
at the closing of Windows.

Any ideas, APIs, tips or tricks well accepted.
Many thanks.

Patrick