#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default cut textbox


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

--
by161
-----------------------------------------------------------------------
by1612's Profile: http://www.excelforum.com/member.php...nfo&userid=861
View this thread: http://www.excelforum.com/showthread.php?threadid=55597

  #2   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default cut textbox


Thanks for your help. My original text box was- drawn- with the macr
recorder on. I then added selection.formula = j7 (the cell containin
the synopsis) to the macro. As I said, this worked fine for displayin
the text box with the text. Now I've changed this to a text box fro
the control toolbar (TextBox1), and while my buttons can make the bo
appear and disappear, I can't seem to link the text I want to the box
The error message says that my text box (selection.formuls =) does no
support this method.
So how do I link my content cell to the box

--
by161
-----------------------------------------------------------------------
by1612's Profile: http://www.excelforum.com/member.php...nfo&userid=861
View this thread: http://www.excelforum.com/showthread.php?threadid=55597

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default cut textbox

Here is the format I use. I suppose what is on the right of the = will
change depending on user input...

Sub tbtesting()

TextBox1.Value = Sheet1.Range("B21").Value

End Sub

-Chris

"by1612" wrote:


Thanks for your help. My original text box was- drawn- with the macro
recorder on. I then added selection.formula = j7 (the cell containing
the synopsis) to the macro. As I said, this worked fine for displaying
the text box with the text. Now I've changed this to a text box from
the control toolbar (TextBox1), and while my buttons can make the box
appear and disappear, I can't seem to link the text I want to the box.
The error message says that my text box (selection.formuls =) does not
support this method.
So how do I link my content cell to the box?


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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default cut textbox


command button 1 creates my textbox (named textbox1 according to the
properties window). Adding - TextBox1.value = sheet2.range("j7").value
- generates run-time error '424', object required.

command button 2 = TextBox1.cut


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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default cut textbox

Try this:

Private Sub CommandButton1_Click()

'delete tb if it exists
On Error Resume Next
ActiveSheet.TextBoxes("TextBox1").Delete
On Error GoTo 0

'create tb
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHo rizontal, _
120, 110, 210, 100).Select 'size the tb with the 4 #s
Selection.Name = "TextBox1"
Selection.Characters.Text = _
Sheet1.Range("A25").Value 'change depending on user input

End Sub

Hope that helps.
-Chris

"by1612" wrote:


command button 1 creates my textbox (named textbox1 according to the
properties window). Adding - TextBox1.value = sheet2.range("j7").value
- generates run-time error '424', object required.

command button 2 = TextBox1.cut


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


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default cut textbox


Thanks Chris! Works great.


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

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default cut textbox


I'm sorry, it seems that each successful step leads to new questions
The generated text box (Text Box1) has a 256 character maximum, wit
set character size, font, etc. I guess because of it's nature, the T
has no properties window that I can access. Where do I inser
statements to change these properties

--
by161
-----------------------------------------------------------------------
by1612's Profile: http://www.excelforum.com/member.php...nfo&userid=861
View this thread: http://www.excelforum.com/showthread.php?threadid=55597

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
HELP! I Lost The Ability To Advance From TextBox To TextBox With the ENTER Or The TAB Keys Minitman[_4_] Excel Programming 0 February 22nd 05 08:50 PM
Textbox Bug? Missing/delayed update of textbox filled via VBA MarcM Excel Programming 0 November 4th 04 05:47 PM
Textbox Bug? Missing/delayed update of textbox filled via VBA MarcM Excel Programming 0 November 4th 04 05:43 PM
How to move cursor from one textbox control to another textbox con Tom Ogilvy Excel Programming 1 September 16th 04 03:42 PM
How to move cursor from one textbox control to another textbox con KMoore007 Excel Programming 0 September 16th 04 02:47 PM


All times are GMT +1. The time now is 05:18 PM.

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

About Us

"It's about Microsoft Excel"