K
kiln
I have an Access 2000 app were a user may open Word docs, the path to
the doc being stored in the db. I have this problem were if I open a
word doc via code, and the user then closes word, the next time the user
requests a word doc, it doesn't fly. An instance of Word *is* created,
you can see it in task manager (only one instance). There is no Word
instance in the period between the first and second request. What am I
doing wrong? Why doesn't the code below utilize this running instance of
Word (word 2002)?
Some of this code comes from the Access Web, I'll not include the call
that tests for a running instace of word (fIsAppRunning()), it works
fine.
The error that appears is error 462 "The remote server machine does not
exist or is unavailable". Yet, word is running. It opens, without
loading the specified doc.
Private Sub cmdOpenDoc()
On Error GoTo ErrHandler
Dim objWord As Object
Dim oDoc As Word.Document
If fIsAppRunning("Word") Then
Set objWord = GetObject(, "Word.Application")
objWord.Visible = True
Else
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
End If
' This fails if the user has opened then closed a word doc via this
code before:
Set oDoc = Word.Documents.Open(strMyDoc)
ExitHere:
Exit Sub
ErrHandler:
MsgBox "Error " & Err & ": " & Error
Resume ExitHere
End Sub
the doc being stored in the db. I have this problem were if I open a
word doc via code, and the user then closes word, the next time the user
requests a word doc, it doesn't fly. An instance of Word *is* created,
you can see it in task manager (only one instance). There is no Word
instance in the period between the first and second request. What am I
doing wrong? Why doesn't the code below utilize this running instance of
Word (word 2002)?
Some of this code comes from the Access Web, I'll not include the call
that tests for a running instace of word (fIsAppRunning()), it works
fine.
The error that appears is error 462 "The remote server machine does not
exist or is unavailable". Yet, word is running. It opens, without
loading the specified doc.
Private Sub cmdOpenDoc()
On Error GoTo ErrHandler
Dim objWord As Object
Dim oDoc As Word.Document
If fIsAppRunning("Word") Then
Set objWord = GetObject(, "Word.Application")
objWord.Visible = True
Else
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
End If
' This fails if the user has opened then closed a word doc via this
code before:
Set oDoc = Word.Documents.Open(strMyDoc)
ExitHere:
Exit Sub
ErrHandler:
MsgBox "Error " & Err & ": " & Error
Resume ExitHere
End Sub