K
Kees
I'm opening and edeting an existing Word doc. using the following code in
Access.
Every time using it the fist time it works ok, but using it the second time
(for a new document) I get an error. Only after a restart I can use the code
again, but using the second time again an error.
the error is: the external server computer does not exist or is not
available.
Some one any idee ??
Kees
Dim objWord As Object
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
objWord.Documents.Open FileName:=stDocName
Set myrange = ActiveDocument.Range(Start:=0, End:=0)
With myrange.Find
..ClearFormatting
..Text = "===CONCEPT==="
With .Replacement
..ClearFormatting
..Text = ""
End With
..Execute Replace:=wdReplaceAll, _
Format:=True, MatchCase:=False, _
MatchWholeWord:=True
End With
ActiveDocument.Close
objWord.Quit SaveChanges:=wdSaveChanges
Set objWord = Nothing
Set myrange = Nothing
'
Access.
Every time using it the fist time it works ok, but using it the second time
(for a new document) I get an error. Only after a restart I can use the code
again, but using the second time again an error.
the error is: the external server computer does not exist or is not
available.
Some one any idee ??
Kees
Dim objWord As Object
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
objWord.Documents.Open FileName:=stDocName
Set myrange = ActiveDocument.Range(Start:=0, End:=0)
With myrange.Find
..ClearFormatting
..Text = "===CONCEPT==="
With .Replacement
..ClearFormatting
..Text = ""
End With
..Execute Replace:=wdReplaceAll, _
Format:=True, MatchCase:=False, _
MatchWholeWord:=True
End With
ActiveDocument.Close
objWord.Quit SaveChanges:=wdSaveChanges
Set objWord = Nothing
Set myrange = Nothing
'