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 / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Is it possible to loop through text?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sam Kuo - 29 May 2008 22:37 GMT
Is it possible to loop through text, as it would for number? For example:
   
  Dim Text As Integer  ' where Text = "Before", "Now", or "After"
  For Text
     ' code goes here
     ' i.e. Me.Controls("txt" & Text).Visible = True
  Next Text
Bob Phillips - 29 May 2008 22:41 GMT
Dim sText As String
Dim ary As Variant
Dim i As Long

   sText = "Before,Now,After"
   ary = Split(sText, ",")
   For i = LBound(ary) To UBound(ary)

     'Me.Controls("txt" & ary(i)).Visible = True

Signature

---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

> Is it possible to loop through text, as it would for number? For example:
>
[quoted text clipped - 3 lines]
>      ' i.e. Me.Controls("txt" & Text).Visible = True
>   Next Text
Rick Rothstein (MVP - VB) - 29 May 2008 23:12 GMT
It can be done this way also...

 Dim V As Variant
 For Each V In Split("Before,Now,After", ",")
   Me.Controls("txt" & V).Visible = True
 Next

Rick

> Dim sText As String
> Dim ary As Variant
[quoted text clipped - 13 lines]
>>      ' i.e. Me.Controls("txt" & Text).Visible = True
>>   Next Text
Sam Kuo - 30 May 2008 01:19 GMT
Hi Bob and Rick
Thanks alot!

> It can be done this way also...
>
[quoted text clipped - 22 lines]
> >>      ' i.e. Me.Controls("txt" & Text).Visible = True
> >>   Next Text
 
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.