asilverblatt
Programmer
Earlier this year, I developed a VB 6 application to automatically generate letters as Microsoft Word documents. After extensive testing and debugging, it worked flawlessly on my Win XP development machine. Now, while I'm attempting to troubleshoot a run-time error the end users are having, the same application throws this error on my machine:
-2147417851
Automation error
The server threw an exception.
when it executes the "Set WordDoc =" statement shown below. This happens regardless of whether I'm running the compiled .EXE or in the VB IDE, and regardless of whether an instance of Word is already running. The document whose name is stored in the constant BHRSLetterName exists and can be opened manually without any problem.
Does anyone have a clue as to why this would suddenly stopped working, and how to correct it? Thanks in advance.
[the following code is in a standard module]
Public Const BHRSLetterName = "\\Parker\BHRSLetters\BHRS Welcome Letter.doc"
[the following code is in a form module]
Private Sub DoLetters(...)
...
Dim WordApp As New Word.Application
...
CreateLetter ..., WordApp, ...
...
End Sub
Private Sub CreateLetter(..., WordApp As Word.Application, ...)
Dim WordDoc As Word.Document
...
Set WordDoc = WordApp.Documents.Open(BHRSLetterName, , True)
...
End Sub
-2147417851
Automation error
The server threw an exception.
when it executes the "Set WordDoc =" statement shown below. This happens regardless of whether I'm running the compiled .EXE or in the VB IDE, and regardless of whether an instance of Word is already running. The document whose name is stored in the constant BHRSLetterName exists and can be opened manually without any problem.
Does anyone have a clue as to why this would suddenly stopped working, and how to correct it? Thanks in advance.
[the following code is in a standard module]
Public Const BHRSLetterName = "\\Parker\BHRSLetters\BHRS Welcome Letter.doc"
[the following code is in a form module]
Private Sub DoLetters(...)
...
Dim WordApp As New Word.Application
...
CreateLetter ..., WordApp, ...
...
End Sub
Private Sub CreateLetter(..., WordApp As Word.Application, ...)
Dim WordDoc As Word.Document
...
Set WordDoc = WordApp.Documents.Open(BHRSLetterName, , True)
...
End Sub