Help,
I have a situation where I need to search for specific string and if it exists then do some formating.
What I did was to record a macro in Word and then translate it back to VBS. This seemed to work on one of my machines under Windows ME and Word 2000. However I have tried using under Word 97 and get the error "Object doesn't support this property or method" at the line "objWord.Selection.Find.Excecute".
What am I doing wrong?.
Can any body suggest a way of doing this?
I am only new to VBscript and how to intergrate it into applications. Most of my experiance has been writing system in character based languages. Any help you can give will be appreciated.
Thanks
EXTRACT OF CODE
Set objWord = WScript.CreateObject("Word.Application"
objWord.ActiveWindow.View.Type = 1 'wdNormalView
objWord.Selection.Find.ClearFormatting
objWord.Selection.Find.Text = "<<TSTATUS>>"
objWord.Selection.Find.Replacement.Text = ""
objWord.Selection.Find.Forward = True
objWord.Selection.Find.Wrap = 1 'wdFindContinue
objWord.Selection.Find.Format = False
objWord.Selection.Find.MatchCase = False
objWord.Selection.Find.MatchWholeWord = False
objWord.Selection.Find.MatchWildcards = False
objWord.Selection.Find.MatchSoundsLike = False
objWord.Selection.Find.MatchAllWordForms = False
objWord.Selection.Find.Excecute
if objWord.Selection.Find.Found Then
do something!!!!
end if
I have a situation where I need to search for specific string and if it exists then do some formating.
What I did was to record a macro in Word and then translate it back to VBS. This seemed to work on one of my machines under Windows ME and Word 2000. However I have tried using under Word 97 and get the error "Object doesn't support this property or method" at the line "objWord.Selection.Find.Excecute".
What am I doing wrong?.
Can any body suggest a way of doing this?
I am only new to VBscript and how to intergrate it into applications. Most of my experiance has been writing system in character based languages. Any help you can give will be appreciated.
Thanks
EXTRACT OF CODE
Set objWord = WScript.CreateObject("Word.Application"
objWord.ActiveWindow.View.Type = 1 'wdNormalView
objWord.Selection.Find.ClearFormatting
objWord.Selection.Find.Text = "<<TSTATUS>>"
objWord.Selection.Find.Replacement.Text = ""
objWord.Selection.Find.Forward = True
objWord.Selection.Find.Wrap = 1 'wdFindContinue
objWord.Selection.Find.Format = False
objWord.Selection.Find.MatchCase = False
objWord.Selection.Find.MatchWholeWord = False
objWord.Selection.Find.MatchWildcards = False
objWord.Selection.Find.MatchSoundsLike = False
objWord.Selection.Find.MatchAllWordForms = False
objWord.Selection.Find.Excecute
if objWord.Selection.Find.Found Then
do something!!!!
end if