View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
monika monika is offline
external usenet poster
 
Posts: 27
Default getting textbox value

Hi

I am tryign to add dynamic textbox (I am successful...with
the feedback i got from this superb usergrp).
But i am unable to check for its value...i have done a lot
of modification with the code below.. its gives an error
at:
For Each newButton In Me.Controls

any help?
thanks...

Public newButton As MSForms.Control
Private Sub UserForm_Initialize()

numOfSheets = 4
z = 18
If numOfSheets 4 Then frmAddMoreSheets.Height = 300
For i = 1 To numOfSheets
Set newButton = Me.Controls.Add
("Forms.Textbox.1", "txtBox")
newButton.Name = "Textbox" & i
z = z + 30
With newButton
.Left = 18
.Top = z
.Visible = True
End With

Next i
'Unload Me
End Sub
Private Sub CommandButton1_Click()
For i = 1 To numOfSheets
'If TextBox & i.Value = "" Then MsgBox "emptu"
Next i
For Each newButton In Me.Controls
With newButton

If .Value = "" Then MsgBox "empty"
End With
Next newButton

End Sub