I have a VBScript that I want to execute inside the browser (IE). The Script opens Word, inserts text, formats the text into a table. The last thing I need the script to do is search for @@@ and replace it with ^l (manual line break).
I have a routine set up that should locate all instances of @@@. I can see that it is moving through the text, but it's not executing the Replace.
My current code looks like this:
app.Selection.WholeStory
app.ActiveDocument.Range.ConvertToTable Separator=wdSeparateByTabs
app.Selection.WholeStory
Do
app.Selection.Find.ClearFormatting
app.Selection.Find.Replacement.ClearFormatting
app.Selection.Find.Text = "@@@"
app.Selection.Find.Replacement.Text = "^l"
app.Selection.Find.Forward = True
app.Selection.Find.Wrap = True
app.Selection.Find.Format = False
app.Selection.Find.MatchCase = False
app.Selection.Find.MatchWholeWord = False
app.Selection.Find.MatchWildcards = False
app.Selection.Find.MatchSoundsLike = False
app.Selection.Find.MatchAllWordForms = False
app.Selection.Find.Replace = wdReplaceAll
app.Selection.Find.Execute "@@@", "^l", wdReplaceAll
If app.Selection.Find.Execute = False Then Exit Do
Loop
I cobbled this code together by recording a macro and then playing with the results. One of the problems I am having is that the macro uses code like this:
Selection.Find.Execute Replace:=wdReplaceAll
The browser really does not like the := construction.
Can someone tell me how to get the replace to execute without using :=?
Thanks.
I have a routine set up that should locate all instances of @@@. I can see that it is moving through the text, but it's not executing the Replace.
My current code looks like this:
app.Selection.WholeStory
app.ActiveDocument.Range.ConvertToTable Separator=wdSeparateByTabs
app.Selection.WholeStory
Do
app.Selection.Find.ClearFormatting
app.Selection.Find.Replacement.ClearFormatting
app.Selection.Find.Text = "@@@"
app.Selection.Find.Replacement.Text = "^l"
app.Selection.Find.Forward = True
app.Selection.Find.Wrap = True
app.Selection.Find.Format = False
app.Selection.Find.MatchCase = False
app.Selection.Find.MatchWholeWord = False
app.Selection.Find.MatchWildcards = False
app.Selection.Find.MatchSoundsLike = False
app.Selection.Find.MatchAllWordForms = False
app.Selection.Find.Replace = wdReplaceAll
app.Selection.Find.Execute "@@@", "^l", wdReplaceAll
If app.Selection.Find.Execute = False Then Exit Do
Loop
I cobbled this code together by recording a macro and then playing with the results. One of the problems I am having is that the macro uses code like this:
Selection.Find.Execute Replace:=wdReplaceAll
The browser really does not like the := construction.
Can someone tell me how to get the replace to execute without using :=?
Thanks.