samedi 28 février 2015

VBA Pattern Fail When Totally Obvious

When I ctrl-f in a spreadsheet, I can find the text, "child Support," but when I'm using it as a pattern it fails. Other obvious words work, like "Date," for instance.


This spreadsheet was converted from a PDF. Could there be some hidden null characters that are causing this column to be ignored?



Private Function RegExTest(s As String) As String
Dim re, match
Set re = CreateObject("vbscript.regexp")
re.Pattern = "(child support)"
re.Global = True

For Each match In re.Execute(s)
MsgBox match.value
RegExDate = match.value
Exit For
Next
Set re = Nothing
End Function


(Apologies if this code is rough, I'm a contractor and the box I'm really on is nannied by some bs so I can't copy and paste.)


Aucun commentaire:

Enregistrer un commentaire