View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272[_2_] ryguy7272[_2_] is offline
external usenet poster
 
Posts: 56
Default Find a Pattern and Parse Text

How can I use VBA to find a pattern such as ‘Checked Out To:’ and
everything between the quotes?

The Excel file will have 16 characters, 20 with the .xls extension.
Then there is a Return. Then ‘Checked Out To:’ with last name comma
first name and there MAY be some brackets after that. Everything will
ALWAYS be between quotes.

“9900010X10G00904.xls
Checked Out To: Jupree, Jasper [C-TO]”

“9900010X10G11208.xls
Checked Out To: Malfree, Jim”

I’m experimenting with a concept such as this:
If InStr(1, my_var, "Checked Out To: " & activeWB = "Checked Out To: "
& activeWB, vbTextCompare) 0 Then
‘Something . . . MsgBox ()
End If

There is a pattern, as described above, but I’m not sure how to parse
everything between the quotes.

Just so you know, all data comes from a URL; the my_var variable comes
from this URL . . . all of this works fine!
(Thanks Ron . . . )

Any ideas on how to handle this?

Thanks!!