Iterate through all words
"Claus Busch" wrote:
store your words in varText:
Sub Test()
Dim ptrn As String
Dim Matches, Match
Dim re As Object
Dim varText() As Variant
Dim n As Long
Set re = CreateObject("vbscript.regexp")
ptrn = "\w+"
re.Pattern = ptrn
re.IgnoreCase = False
re.Global = True
Set Matches = re.Execute(s)
ReDim Preserve varText(Matches.Count - 1)
For Each Match In Matches
varText(n) = Match.Value
n = n + 1
Next
End Sub
Hi Claus. A few questions....
How do you recommend that I store my words
in the varText variable? I typically load an entire text
file into a string variable using ReadTextFile().
Also, your code above refers to a variable "s" without
initializing any value. What is this variable?
Thanks!
|