View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Check all textboxes

try this. If you have shapes like rectangle it will also look for the text
boxes in shapes.


Sub CommandButton1_click()

For Each Control In Sheets("sheet1").Shapes

If Control.Type = msoTextBox Then

If Control.DrawingObject.Caption = "" Then
MsgBox "fill it"
Else
MsgBox "its filled"
End If
End If

Next Control
End Sub

"stewart" wrote:

how can i get this too work. What am I doing wrong? My code is just
a guess based on other snipets I have seen and used.

Private Sub CommandButton1_Click()
For Each Control In
ThisWorkbook.VBProject.VBComponents("frmEvaluation ").Designer.Controls(MultiPage1).Pages(0)
If TypeOf Control Is MSForms.TextBox Then
If Control.Value = "" Then
MsgBox "fill it"
Else
MsgBox "its filled"
End If
End If
Next Control

I want to check all of the textboxes on page 0 to make sure that they
conatain an input from the user.