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 / January 2006

Tip: Looking for answers? Try searching our database.

Breaking apart a string

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Charlie - 30 Jan 2006 05:46 GMT
I have a string (strSentence) that my code has copied off the Word document
and I know that it’s setup with this format:
John & Jane Doe <tab>Jim, Anne <tab> 1,2,3

The first part of the sentence is a name, either first & last or first,
wife, and last.
Then a tab
Then a sequence of one to four names separated by “,”
Then a tab
The a sequence of a few numbers separated by “,”

How can I programmatically break this down into the following 3 strings:
Name (everything before the first tab)
Children (everything between the tabs)
Number  (everything after the second tab)

Thanks,
Ck
Tony Jollans - 30 Jan 2006 08:23 GMT
Try using Split (assuming you have at least Word 2000) ...

   Dim Phrases ' must be defined as a variant
   Phrases = Split(strSentence,vbTab)

   Msgbox Phrases(0) ' so you can see what they are
   Msgbox Phrases(1)
   Msgbox Phrases(2)

--
Enjoy,
Tony

> I have a string (strSentence) that my code has copied off the Word document
> and I know that it's setup with this format:
[quoted text clipped - 14 lines]
> Thanks,
> Ck

Rate this thread:






 
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.