Home |
Search |
Today's Posts |
#1
|
|||
|
|||
clearing text from text boxes
Can someone instruct me on how to create a macro that clears text out of text
boxes (from the control toolbox) please? Thanks in advance. |
#2
|
|||
|
|||
As an example
activesheet.oleobjects("TextBox1").object.text="" -- HTH RP (remove nothere from the email address if mailing direct) "Jae" wrote in message ... Can someone instruct me on how to create a macro that clears text out of text boxes (from the control toolbox) please? Thanks in advance. |
#3
|
|||
|
|||
Hi Bob,
I'm not too familiar with VBA. Can you show me what syntax I need to get this to work? Thanks again, Jae "Bob Phillips" wrote: As an example activesheet.oleobjects("TextBox1").object.text="" -- HTH RP (remove nothere from the email address if mailing direct) "Jae" wrote in message ... Can someone instruct me on how to create a macro that clears text out of text boxes (from the control toolbox) please? Thanks in advance. |
#4
|
|||
|
|||
Jae,
The syntax is exactly what Bob posted. E.g., Sub AAA() activesheet.oleobjects("TextBox1").object.text="" End Sub Change the "TextBox1" to the name of your text box control. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Jae" wrote in message ... Hi Bob, I'm not too familiar with VBA. Can you show me what syntax I need to get this to work? Thanks again, Jae "Bob Phillips" wrote: As an example activesheet.oleobjects("TextBox1").object.text="" -- HTH RP (remove nothere from the email address if mailing direct) "Jae" wrote in message ... Can someone instruct me on how to create a macro that clears text out of text boxes (from the control toolbox) please? Thanks in advance. |
#5
|
|||
|
|||
I also have a number of text boxes. Is there a way to get them all at once?
"Jae" wrote: Hi Bob, I'm not too familiar with VBA. Can you show me what syntax I need to get this to work? Thanks again, Jae "Bob Phillips" wrote: As an example activesheet.oleobjects("TextBox1").object.text="" -- HTH RP (remove nothere from the email address if mailing direct) "Jae" wrote in message ... Can someone instruct me on how to create a macro that clears text out of text boxes (from the control toolbox) please? Thanks in advance. |
#6
|
|||
|
|||
No, you can't clear them out with a single line of code. You'll
have to loop through them. For example, Sub ClearTextBoxes() Dim OLEObj As OLEObject For Each OLEObj In ActiveSheet.OLEObjects If TypeOf OLEObj.Object Is msforms.TextBox Then OLEObj.Object.Text = "" End If Next OLEObj End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Jae" wrote in message ... I also have a number of text boxes. Is there a way to get them all at once? "Jae" wrote: Hi Bob, I'm not too familiar with VBA. Can you show me what syntax I need to get this to work? Thanks again, Jae "Bob Phillips" wrote: As an example activesheet.oleobjects("TextBox1").object.text="" -- HTH RP (remove nothere from the email address if mailing direct) "Jae" wrote in message ... Can someone instruct me on how to create a macro that clears text out of text boxes (from the control toolbox) please? Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Formulas dealing with text data | Excel Worksheet Functions | |||
Clearing Check Boxes and Cells | Excel Discussion (Misc queries) | |||
Clearing Check Boxes and Cells | Excel Discussion (Misc queries) | |||
Excel 2002 Will Not Print Text Boxes | Excel Discussion (Misc queries) | |||
Text Boxes | Excel Discussion (Misc queries) |