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 / November 2005

Tip: Looking for answers? Try searching our database.

Loop through Multiple Line Textbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
LEC - 04 Nov 2005 13:02 GMT
Good morning,

I would like some help on looping through a multipleline text box.  I
have a textbox that is populated with dates.  Let's say for example
that the text box has 20 dates.  I would like to put the first five
dates in a document, then have a blank line, then the next five dates,
then a blank line and then the next five, etc.  Something like this....

My text box has dates:

Oct 28, 2005
Oct 28, 2006
Oct 28, 2007
Oct 28, 2008
Oct 28, 2009
Oct 28, 2010
Oct 28, 2011
Oct 28, 2012
Oct 28, 2013
Oct 28, 2014

I would like these dates placed on a Word document that would look like
this...

Oct 28, 2005
Oct 28, 2006
Oct 28, 2007
Oct 28, 2008
Oct 28, 2009

Oct 28, 2010
Oct 28, 2011
Oct 28, 2012
Oct 28, 2013
Oct 28, 2014

Any assistance or direction would be appreciated.  Thank you in
advanced.

LEC
Karl E. Peterson - 04 Nov 2005 19:15 GMT
> I would like some help on looping through a multipleline text box.

Take a look at the Split function.  You can do something like this:

 Dim lines As Variant, i As Long
 lines = Split(Textbox1.Text, vbCrLf)
 For i = 0 To UBound(lines)
   ' Do something here with each line
 Next i

> have a textbox that is populated with dates.  Let's say for example
> that the text box has 20 dates.  I would like to put the first five
> dates in a document, then have a blank line, then the next five dates,
> then a blank line and then the next five, etc.  Something like
> this....

To do something special every five, you can use a simple test (within the loop above)
like:

 If (i + 1) Mod 5 = 0 Then
   ' spit out blank line, or whatever
 End If

Later...   Karl
--
Working Without a .NET?
http://classicvb.org/petition
LEC - 04 Nov 2005 23:03 GMT
Thanks Karl!  Really appreciate this...I will give it a shot!
LEC

> > I would like some help on looping through a multipleline text box.
>
[quoted text clipped - 23 lines]
> Working Without a .NET?
> http://classicvb.org/petition
 
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.