Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Jae
 
Posts: n/a
Default 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   Report Post  
Bob Phillips
 
Posts: n/a
Default

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   Report Post  
Jae
 
Posts: n/a
Default

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   Report Post  
Chip Pearson
 
Posts: n/a
Default

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   Report Post  
Jae
 
Posts: n/a
Default

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   Report Post  
Chip Pearson
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formulas dealing with text data Bagia Excel Worksheet Functions 6 June 20th 05 10:29 PM
Clearing Check Boxes and Cells Mel Excel Discussion (Misc queries) 1 May 26th 05 05:13 AM
Clearing Check Boxes and Cells Mel Excel Discussion (Misc queries) 1 May 25th 05 09:00 PM
Excel 2002 Will Not Print Text Boxes Mark Excel Discussion (Misc queries) 3 April 16th 05 12:03 AM
Text Boxes Graham Parkinson Excel Discussion (Misc queries) 2 December 2nd 04 05:01 PM


All times are GMT +1. The time now is 01:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"