Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2005

Tip: Looking for answers? Try searching our database.

Search within String

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
W.Aarts - 27 May 2005 09:14 GMT
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!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.