ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   delete from text box using command button (https://www.excelbanter.com/excel-programming/357588-delete-text-box-using-command-button.html)

john tempest[_2_]

delete from text box using command button
 
i am trying to write some code to clear a text box .the text box is from the
drawing toolbar. i have trid the following but to no avail:
Private Sub CommandButton3_Click()
With Sheet2.Shapes("Text Box 1").TextFrame
..Characters(.Characters.Count + 1).ClearContents
End With
End Sub
any suggestions
regards john

K Dales[_2_]

delete from text box using command button
 
I have run across this; how to get at that text is pretty obscure from the
documentation and object browser! Here is the solution:
Sheet2.Shapes("Text Box 1").OLEFormat.Object.Text=""
--
- K Dales


"john tempest" wrote:

i am trying to write some code to clear a text box .the text box is from the
drawing toolbar. i have trid the following but to no avail:
Private Sub CommandButton3_Click()
With Sheet2.Shapes("Text Box 1").TextFrame
.Characters(.Characters.Count + 1).ClearContents
End With
End Sub
any suggestions
regards john


john tempest[_2_]

delete from text box using command button
 
thank you that works great
regards
john tempest

"K Dales" wrote:

I have run across this; how to get at that text is pretty obscure from the
documentation and object browser! Here is the solution:
Sheet2.Shapes("Text Box 1").OLEFormat.Object.Text=""
--
- K Dales


"john tempest" wrote:

i am trying to write some code to clear a text box .the text box is from the
drawing toolbar. i have trid the following but to no avail:
Private Sub CommandButton3_Click()
With Sheet2.Shapes("Text Box 1").TextFrame
.Characters(.Characters.Count + 1).ClearContents
End With
End Sub
any suggestions
regards john



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com