PC Review


Reply
Thread Tools Rate Thread

concatinate a textbox name

 
 
=?Utf-8?B?RGVubmlz?=
Guest
Posts: n/a
 
      13th Mar 2007
Help,
How can I assign a value to a textbox on a userform without looping through
all the textboxes. Is it possible to assign the name of the textbox to a
string and use that string to immediately assign a value to the textbox with
that name?

Example:
dim sMo as string
dim sCapExp as string
dim sTxb as string

sMo="Jun"
sCapExp="Cap"
sTxb="txb" & sMO & sCapExp

Is there something like the Sheets object where you can place the name in
parenthesis, i.e. sheets("Summary"). can you do, Textbox(sTxb).Value = "it
works"?

Please let me know,

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      13th Mar 2007
You can name the textbox by changing the (name) property while you're designing
the userform.

Inside the VBE
hit ctrl-r (to see the properties window)
Show the userform
select the textbox
change that (name) property to something you like.

Then you can use:
me.controls("myspecialnamehere").text = "sometext here"
or with your variables:
me.controls(Txb).text = "sometext here"



Dennis wrote:
>
> Help,
> How can I assign a value to a textbox on a userform without looping through
> all the textboxes. Is it possible to assign the name of the textbox to a
> string and use that string to immediately assign a value to the textbox with
> that name?
>
> Example:
> dim sMo as string
> dim sCapExp as string
> dim sTxb as string
>
> sMo="Jun"
> sCapExp="Cap"
> sTxb="txb" & sMO & sCapExp
>
> Is there something like the Sheets object where you can place the name in
> parenthesis, i.e. sheets("Summary"). can you do, Textbox(sTxb).Value = "it
> works"?
>
> Please let me know,


--

Dave Peterson
 
Reply With Quote
 
=?Utf-8?B?RGVubmlz?=
Guest
Posts: n/a
 
      14th Mar 2007
Dave,
Thank you so much, this worked perfectly!

"Dennis" wrote:

> Help,
> How can I assign a value to a textbox on a userform without looping through
> all the textboxes. Is it possible to assign the name of the textbox to a
> string and use that string to immediately assign a value to the textbox with
> that name?
>
> Example:
> dim sMo as string
> dim sCapExp as string
> dim sTxb as string
>
> sMo="Jun"
> sCapExp="Cap"
> sTxb="txb" & sMO & sCapExp
>
> Is there something like the Sheets object where you can place the name in
> parenthesis, i.e. sheets("Summary"). can you do, Textbox(sTxb).Value = "it
> works"?
>
> Please let me know,
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatinate name and date Don Microsoft Excel Misc 4 9th Jul 2008 10:35 PM
concatinate data =?Utf-8?B?UmhvbmRh?= Microsoft Excel Worksheet Functions 4 20th Jan 2006 05:51 PM
concatinate and vlookup =?Utf-8?B?ZGFyc2c=?= Microsoft Excel Programming 7 27th Oct 2005 09:53 PM
Concatinate a filename CLR Microsoft Excel Misc 28 1st Aug 2005 11:45 PM
How do I concatinate fields? cri77ers Microsoft Access Reports 7 5th Jan 2004 12:13 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:23 AM.