View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Variable Control name

I am not sure I understood your question...Are you trying to pass the control
name as a variable ....as below

Private Sub CommandButton1_Click()
Dim TBC As Control
Dim strControl As String
strControl = "TextBox1"
Set TBC = UserForm1.Controls(strControl)
MsgBox TBC.Text
End Sub

--
If this post helps click Yes
---------------
Jacob Skaria


"Brett" wrote:

Hi there, I have a sub which gets the value of a Userform (name UF0_QCP)
control name passed into it (tb) but I'm having a little difficulty with the
syntax:

Dim TBC As control
Set TBC = Controls("UF0_QCP." & tb)

What is the missing link please? Regards, Brett