Thread: cut textbox
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
CWillis CWillis is offline
external usenet poster
 
Posts: 36
Default cut textbox

The text box should have a name. While the text box is on the screen, go to
view--toolbars--control toolbox. On that toolbox, click on the design mode
button. (triangle with a pencil). With the four way arrows, click on the
text box. Next to the formula bar on the left should be the name of the text
box. (If you haven't changed its name, it is probably "TextBox1" or
similar.) From there you can change it's name. Make sure you hit enter
after changing it.

Another way to change the name: After clicking on the text box with the
four way arrows, click the properties button on the control toolbox. The
properties will appear for that text box. (Name) should be an option.

In your macro, this may help:

Sub TBPaste()

On Error Resume Next
Sheets("Summ").OLEObjects("LoadCalcTB").Delete
On Error GoTo 0

Sheets("Summ").Select
LCSummTBLoc.Select
ActiveSheet.Paste
Selection.Name = "LoadCalcTB"

End Sub

"LoadCalcTB" is the name of my text box. If it exists, this sub will delete
it and then paste the one previously copied (using another sub routine). The
text box is then named using the last line. "Selection.Name = "LoadCalcTB".

For your code, after you create the text box, call it something. Then at
the beginning of your code, always look for that textbox name. If it exists,
delete it as shown in the code above.

hth
-Chris

"by1612" wrote:


I am adding contols to my brother-in-law's movie collection. After the
user has searched, with the user form, for their movie, I have added a
button, "read about this movie", which, when clicked, generates a
textbox, which is linked to a cell and displays a synopsis of the
movie. This all works fine. The problem arises when I try to cut this
textbox with another macro, and start the process over. I get an error
message saying that the textbox's name can't be found. It doesn't have a
name, only a # generated by the program. How can I name this box, and
where do I insert the name?


--
by1612
------------------------------------------------------------------------
by1612's Profile: http://www.excelforum.com/member.php...fo&userid=8611
View this thread: http://www.excelforum.com/showthread...hreadid=555976