Still problem with word server

O

Ondrej

Hi programmers!

When I want to run my VBA script (which start Word server up and than close
it) second time, this problem occur: "The remote server machine does not
exist or is unavailable"

I've figure out, that server start correctly, but after this command

Selection.LanguageID = wdCzech

the code throw the mentioned exception. Interesting is, that it happen only
when I run my code second time. And, when I remove oWord.Quit 0 at the end
of my code, problem never happen. Only solution so far is completely close
MS Access, from which I call this code. Than I can run my code again once.



For sure, here is my code, which start Word server:

Dim oWord As Word.Application
Dim oDoc As Word.Document

Set oWord = GetObject(, "Word.Application")
If Err Then
Set oWord = New Word.Application
WordWasNotRunning = True
End If

On Error GoTo Err_MakeDocumentsBtn_Click

oWord.Visible = True
oWord.Activate

Set oDoc = oWord.Documents.Add

With oDoc.ActiveWindow

Selection.LanguageID = wdCzech !!!!!!!!!!!!!!!!!! Here is a problem


Ondrej
 

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