N
Nev
Hi,
Im using vba code (see below) in access to perform a
replace in a word document from within access. the first
time i run the code i get the following error "Run-time
error '-2147023174 (800706ba)':
Automation error
The RPC Server is unavailable"
but then i can run it again and it works fine. does anyone
know why this might be happening and how i might resolve
it.
Thanks in advance,
Nev.
Function ModTabandChevReplacer()
Dim objWord As Word.Application
Set objWord = CreateObject("Word.Application")
Documents.Open FileName:="D:\Data\originalreplacer.rtf",
ConfirmConversions:=False _
, ReadOnly:=False, AddToRecentFiles:=False,
PasswordDocument:="", _
PasswordTemplate:="", Revert:=False,
WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
ActiveDocument.Select
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^t"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveDocument.Save
ActiveDocument.Close
Set objWord = Nothing
End Function
Im using vba code (see below) in access to perform a
replace in a word document from within access. the first
time i run the code i get the following error "Run-time
error '-2147023174 (800706ba)':
Automation error
The RPC Server is unavailable"
but then i can run it again and it works fine. does anyone
know why this might be happening and how i might resolve
it.
Thanks in advance,
Nev.
Function ModTabandChevReplacer()
Dim objWord As Word.Application
Set objWord = CreateObject("Word.Application")
Documents.Open FileName:="D:\Data\originalreplacer.rtf",
ConfirmConversions:=False _
, ReadOnly:=False, AddToRecentFiles:=False,
PasswordDocument:="", _
PasswordTemplate:="", Revert:=False,
WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
ActiveDocument.Select
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^t"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveDocument.Save
ActiveDocument.Close
Set objWord = Nothing
End Function