How to close word server

O

Ondrej

Hi everybody,

I am writing MS Access VBA application and I really don't know, hove to
close MS Word server, after all operations.

I start it in this way:
Dim oApp As Object
Set oApp = CreateObject("Word.Application")
oApp.Visible = True

How to close it?


... and sometime, when I close server by myself, it will not start again in
the future and I must to restart MS Access.
How can I detect, if server is already running?

Thanks a lot.

Ondrej
 
J

Jonathan West

Ondrej said:
Hi everybody,

I am writing MS Access VBA application and I really don't know, hove to
close MS Word server, after all operations.

I start it in this way:
Dim oApp As Object
Set oApp = CreateObject("Word.Application")
oApp.Visible = True

How to close it?

oApp.Quit 0
Set oApp = Nothing
.. and sometime, when I close server by myself, it will not start again in
the future and I must to restart MS Access.
How can I detect, if server is already running?

Try to access a running instance of Word using GetObject rather than
CreateObject. If that gives you an error, then try CreatObject. The
following article described more of this

Control Word from Excel
http://www.word.mvps.org/FAQs/InterDev/ControlWordFromXL.htm

The same code can be used from Access as from Excel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top