We've got a string (Adres) received from a database
How can I search within the string for a comma (,)?
I want to use it in the way described below
if the string contains (,) then
....
else
......
Thank you!
Doug Robbins - 27 May 2005 12:27 GMT
Use the InStr() command. Look in the VBA help file for the syntax. If what
you are searching for is not in the string it will return 0.

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> We've got a string (Adres) received from a database
> How can I search within the string for a comma (,)?
[quoted text clipped - 5 lines]
>
> Thank you!
Helmut Weber - 27 May 2005 12:31 GMT
Hi,
if instr(Mystring, ",") then
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
Klaus Linke - 31 May 2005 18:53 GMT
If you need all the fields from the comma-delimited string, the easiest way would be the Split:
Dim myText As Variant, i As Long
myText = Split("a,b,c", ",")
For i = LBound(myText) To UBound(myText)
MsgBox myText(i)
Next i
Regards,
Klaus
> We've got a string (Adres) received from a database
> How can I search within the string for a comma (,)?
[quoted text clipped - 5 lines]
>
> Thank you!