I'm trying to do Find/Replace within textBoxes on Mac using Word vX and
'do Visual Basic'.
The version of Word shouldn't really matter right? Since I'm using
'do Visual Basic'....
I've tried so many different constructs I cannot remember them all.
But no syntax I have come up with allows me to get to the text.
BTW: These are textBoxes created by doing Insert/Text Box off the menu.
No userForms...
The vb I'm using is below.
I'm convinced that the 'With' statement inside the Do Until is the key.
Here's my results:
With pTextBox.Text.Select --> invalid qualifier
With pTextBox.TextFrame.Select -->method or data member not found
With pTextBox.TextRange.Select -->method or data member not found
With pTextBox.TextFrame.TextRange.Select -->method or data member not
found
Can somebody boost me over this particular hump?
Thanks SO MUCH!
This is the last issue in implementation for me
BTW: Where is the best documentation source where I could have found
the answer myself?
Steve
__________________________
set vbScript to "
Dim pTextBox as Word.Range
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Forward = True
Selection.Find.MatchCase =True
Selection.Find.Format = False
Selection.Find.Wrap = wdFindContinue
Set pTextBox = ActiveDocument.StoryRanges(wdTextFrameStory)
on error goto 0
Do until pTextBox is nothing
With pTextBox.Text.Select <--- this is the statement
Selection.Find.Text = \"ABC\"
Selection.Find.Replacement.Text = \"XYZ\"
Selection.Find.Execute Replace:=wdReplaceAll
End With
set pTextBox = pTextBox.NextStoryRange
Loop
"