W
WC Justice
I am using Access 2002/2003 as a front end for a SQL Server database and
make extensive use of automation to populate Word templates. I have
recently begun to experience the following error message:
"The remote server machine does not exist or is unavailable"
The strange thing is that it never happens on the first try...only on the
second (and subsequent) times, and after more than half of the code has run.
It hangs up at two distinct places: 1) where the code attempts to format
paragraphs and 2) where the code adds a table. Oddly enough, however, if I
hit the Stop/Reset button in the Visual Basic editor between executions I do
not get the error.
As far as I can see, I set all objects to "Nothing", but to no avail. The
basic setup is below
Set WordApp = New Word.Application
strFileLocation = "R:\Data\DocumentTemplates\Filename.dot"
Set WordDoc = WordApp.Documents.Open(strFileLocation, , True)
WordApp.Visible = True
With WordApp.Selection
-
-
- First hang up
Else
.ParagraphFormat.LeftIndent = InchesToPoints(0)
-
-
- Second hang up
WordApp.ActiveDocument.Tables.Add Selection.Range, 1, 3
-
-
-
strFileName = "R:\ExecutableDocuments\Holding\" & dblContractNumber &
".doc"
WordApp.ActiveDocument.SaveAs strFileName
rsRDO.Close
Set rsRDO = Nothing
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
'WordDoc.Close
Set WordDoc = Nothing
Set WordApp = Nothing
In summary
It always works flawlessly under the following two scenarios:
1) First execution upon opening the Access front end; and
2) Executing after hitting Stop/Reset in the Visual Basic editor.
Outside of that, it hangs up on the following two tasks:
1) formatting a paragraph; or
2) adding a table.
I can give more detail if necessary. I hope this makes sense, and thanks in
advance.
make extensive use of automation to populate Word templates. I have
recently begun to experience the following error message:
"The remote server machine does not exist or is unavailable"
The strange thing is that it never happens on the first try...only on the
second (and subsequent) times, and after more than half of the code has run.
It hangs up at two distinct places: 1) where the code attempts to format
paragraphs and 2) where the code adds a table. Oddly enough, however, if I
hit the Stop/Reset button in the Visual Basic editor between executions I do
not get the error.
As far as I can see, I set all objects to "Nothing", but to no avail. The
basic setup is below
Set WordApp = New Word.Application
strFileLocation = "R:\Data\DocumentTemplates\Filename.dot"
Set WordDoc = WordApp.Documents.Open(strFileLocation, , True)
WordApp.Visible = True
With WordApp.Selection
-
-
- First hang up
Else
.ParagraphFormat.LeftIndent = InchesToPoints(0)
-
-
- Second hang up
WordApp.ActiveDocument.Tables.Add Selection.Range, 1, 3
-
-
-
strFileName = "R:\ExecutableDocuments\Holding\" & dblContractNumber &
".doc"
WordApp.ActiveDocument.SaveAs strFileName
rsRDO.Close
Set rsRDO = Nothing
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
'WordDoc.Close
Set WordDoc = Nothing
Set WordApp = Nothing
In summary
It always works flawlessly under the following two scenarios:
1) First execution upon opening the Access front end; and
2) Executing after hitting Stop/Reset in the Visual Basic editor.
Outside of that, it hangs up on the following two tasks:
1) formatting a paragraph; or
2) adding a table.
I can give more detail if necessary. I hope this makes sense, and thanks in
advance.