I have an Access 2000 application which uses Word automation to create a Word document from a Word template. All works well, except, when I run the program more than once, it fails with:
Runtime error 462: The remote server machine does not exist or is not available.
It always fails with the above error on the code line which reads:
With DocT
.TablesOfContents.Add Range:=Selection.Range, _
RightAlignPageNumbers:=True, _
UseHeadingStyles:=True, _
UpperHeadingLevel:=1, _
LowerHeadingLevel:=3, _
IncludePageNumbers:=True, _
AddedStyles:="", _
UseHyperlinks:=True, _
HidePageNumbersInWeb:=True
...
... other stuff
...
End With
If I leave this code out (which generates the table of contents), then everything works OK; ie. the program is re-runnable, produces the required Word document, but alas, no table of contents!! With this code in, I have to shut down the program after running it once.
Does anyone have any way of handling this situation; possibly re-coding the table of contents code to avoid this situation.
Is there anything I can do up top when the Word application and documents are defined and instantiated which would help.
Any help would be greatly appreciated,
Cheers,
Steve
Runtime error 462: The remote server machine does not exist or is not available.
It always fails with the above error on the code line which reads:
With DocT
.TablesOfContents.Add Range:=Selection.Range, _
RightAlignPageNumbers:=True, _
UseHeadingStyles:=True, _
UpperHeadingLevel:=1, _
LowerHeadingLevel:=3, _
IncludePageNumbers:=True, _
AddedStyles:="", _
UseHyperlinks:=True, _
HidePageNumbersInWeb:=True
...
... other stuff
...
End With
If I leave this code out (which generates the table of contents), then everything works OK; ie. the program is re-runnable, produces the required Word document, but alas, no table of contents!! With this code in, I have to shut down the program after running it once.
Does anyone have any way of handling this situation; possibly re-coding the table of contents code to avoid this situation.
Is there anything I can do up top when the Word application and documents are defined and instantiated which would help.
Any help would be greatly appreciated,
Cheers,
Steve