Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default HOW TO SELECT THE TEXT BOX?

My application needs copying text box contents (eg.text box 1) from sheet 1
to antoher text box in sheet 2. For that i tried to select text box but i
found it is not possible. What is the code for this task? (The text box is
ordinary text box and not the text box from active control or form control)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 174
Default HOW TO SELECT THE TEXT BOX?

Hi,

Do you mean a textbox from the drawing toolbar?

Try

Activesheet.shapes.count, this should return the number of shapes in the
worksheet.

Next, you can get the names of the shapes with

activesheet.shapes(x).name with x is a number between 1 and the result of
the .count instruction.

To select: activesheet.shapes(x).select

With
selection.characters.text you can read or set the text.

Something as

Sub AAAA
Dim str As String

With ActiveSheet
.Shapes("Text Box 3").Select
str = Selection.Characters.Text
.Shapes("Text Box 2").Select
Selection.Characters.Text = str
End With

End Sub


should do what you want.

Wkr,

JP

"ezil" wrote in message
...
My application needs copying text box contents (eg.text box 1) from sheet
1
to antoher text box in sheet 2. For that i tried to select text box but i
found it is not possible. What is the code for this task? (The text box is
ordinary text box and not the text box from active control or form
control)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default HOW TO SELECT THE TEXT BOX?

Try it like this...

Worksheets("Sheet2").TextBoxes("Text Box 1").Text = _
Worksheets("Sheet1").TextBoxes("Text Box 1").Text

where you would use the appropriate worksheet names in place of my "Sheet1"
and "Sheet2" example names and the appropriate Text Box names in place of my
example "Text Box 1" and "Text Box 2".

--
Rick (MVP - Excel)


"ezil" wrote in message
...
My application needs copying text box contents (eg.text box 1) from sheet
1
to antoher text box in sheet 2. For that i tried to select text box but i
found it is not possible. What is the code for this task? (The text box is
ordinary text box and not the text box from active control or form
control)


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default HOW TO SELECT THE TEXT BOX?

By the way, if you are unsure of how to get the names Excel assigns to its
Shape objects (whether they be Text Boxes or any other shape object), simply
select the shape object and then execute this statement in the VB editor's
Immediate window...

? Selection.Name

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
Try it like this...

Worksheets("Sheet2").TextBoxes("Text Box 1").Text = _
Worksheets("Sheet1").TextBoxes("Text Box 1").Text

where you would use the appropriate worksheet names in place of my
"Sheet1" and "Sheet2" example names and the appropriate Text Box names in
place of my example "Text Box 1" and "Text Box 2".

--
Rick (MVP - Excel)


"ezil" wrote in message
...
My application needs copying text box contents (eg.text box 1) from sheet
1
to antoher text box in sheet 2. For that i tried to select text box but i
found it is not possible. What is the code for this task? (The text box
is
ordinary text box and not the text box from active control or form
control)



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
select text in cell based on text from another cell, paste the text at the begining of a thrid cell, etc... jsd219 Excel Programming 0 October 19th 06 05:04 PM
Text desappears when I select wrap text galse Excel Discussion (Misc queries) 4 June 2nd 06 09:28 PM
Select text from a field Bob[_67_] Excel Programming 4 November 2nd 05 10:36 PM
Select Text in TextBox ben Excel Programming 4 June 14th 05 07:33 PM
Select Case with Text Marie Excel Programming 3 February 10th 05 05:31 PM


All times are GMT +1. The time now is 07:15 AM.

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"