Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Donna Thompson   on Oct 26 In MS Office Category.

  
Question Answered By: Jawahir Burki   on Oct 26

The below code works in word and I'm pretty sure it should work in
Excel too.
It goes through all the text  boxes regardless of name. You will need
to have the extenibility library referenced.

Otherwise you would have to name the text boxes and clear  each one
seperately

Public Sub subClearTextBoxes(frmpForm As Object)

Dim intlNumberOfControls As Integer
Dim ctlCurrent As Control
Dim strlControlType As String
Dim slFormName As String

intlNumberOfControls = frmpForm.Controls.count
For Each ctlCurrent In frmpForm.Controls
If TypeOf ctlCurrent Is MSForms.TextBox Then
ctlCurrent.Text = ""
End If
Next ctlCurrent
'
**********************************************************************
*
End Sub

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Clear TextBoxes in Excel UserForms Or get search suggestion and latest updates.


Tagged: