N
Nev
Hi,
I have generatad the code to perform a replace in word. I
now want to run the code from within access 97 but it
complains about variables being undefined for the word
applied functions like wdReplaceAll and wdFindContinue.
here is the code
Sub mcoReplacer()
Dim objword As Object
Set objword = CreateObject("Word.Application")
Set objword = GetObject("filename", "Word.Document")
objword.Application.Visible = True
objword.Open FileName:="filename",
ConfirmConversions:=False _
, ReadOnly:=False, AddToRecentFiles:=False,
PasswordDocument:="", _
PasswordTemplate:="", Revert:=False,
WritePasswordDocument:="", _
WritePasswordTemplate:="" ',
Format:=wdOpenFormatAuto
objword.ClearFormatting
objword.Selection.Find.ClearFormatting
objword.Selection.Find.Replacement.ClearFormatting
With objword.Selection.Find
.Text = "^t"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
objword.Selection.Find.Execute Replace:=wdReplaceAll
objword.Save
objword.Close
End Sub
Does anyone know what the problem may be?
Thanks in advance.
Nev.
I have generatad the code to perform a replace in word. I
now want to run the code from within access 97 but it
complains about variables being undefined for the word
applied functions like wdReplaceAll and wdFindContinue.
here is the code
Sub mcoReplacer()
Dim objword As Object
Set objword = CreateObject("Word.Application")
Set objword = GetObject("filename", "Word.Document")
objword.Application.Visible = True
objword.Open FileName:="filename",
ConfirmConversions:=False _
, ReadOnly:=False, AddToRecentFiles:=False,
PasswordDocument:="", _
PasswordTemplate:="", Revert:=False,
WritePasswordDocument:="", _
WritePasswordTemplate:="" ',
Format:=wdOpenFormatAuto
objword.ClearFormatting
objword.Selection.Find.ClearFormatting
objword.Selection.Find.Replacement.ClearFormatting
With objword.Selection.Find
.Text = "^t"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
objword.Selection.Find.Execute Replace:=wdReplaceAll
objword.Save
objword.Close
End Sub
Does anyone know what the problem may be?
Thanks in advance.
Nev.