Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Copy Selected Text from Text Box

Hello Friends,

Can anyone help with the following?

I am using a Control Toolbox text box on a worksheet so that users can
enter freetex ongoing, I need the users to be able to highlight a
range of the text to either copy to the clipboard or print it. At the
moment I can only copy all of the data contained in the text box with
the below code, can anyone add to this please?

Private Sub Label2_Click()
Dim MyData As DataObject
Set MyData = New DataObject
MyData.SetText TextBox1.Text
MyData.PutInClipboard
'wdapp.Selection.Copy
Set MyData = Nothing

'With Sheet10.TextBox1
' .SelStart = 0
' .SelLength = Len(TextBox1.Text)
' .Copy
' '.Shapes("TextBox1").Select Selection.Characters.Text
'End With
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Copy Selected Text from Text Box

Look at the .SelText property of the text box.

NickHK

wrote in message
oups.com...
Hello Friends,

Can anyone help with the following?

I am using a Control Toolbox text box on a worksheet so that users can
enter freetex ongoing, I need the users to be able to highlight a
range of the text to either copy to the clipboard or print it. At the
moment I can only copy all of the data contained in the text box with
the below code, can anyone add to this please?

Private Sub Label2_Click()
Dim MyData As DataObject
Set MyData = New DataObject
MyData.SetText TextBox1.Text
MyData.PutInClipboard
'wdapp.Selection.Copy
Set MyData = Nothing

'With Sheet10.TextBox1
' .SelStart = 0
' .SelLength = Len(TextBox1.Text)
' .Copy
' '.Shapes("TextBox1").Select Selection.Characters.Text
'End With
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Copy Selected Text from Text Box

Fantastic,

its easy when you know how.

Dim MyData As DataObject
Set MyData = New DataObject
MyData.SetText TextBox1.SelText
MyData.PutInClipboard
'wdapp.Selection.Copy
Set MyData = Nothing

thank you very much Nick


NickHK wrote:
Look at the .SelText property of the text box.

NickHK

wrote in message
oups.com...
Hello Friends,

Can anyone help with the following?

I am using a Control Toolbox text box on a worksheet so that users can
enter freetex ongoing, I need the users to be able to highlight a
range of the text to either copy to the clipboard or print it. At the
moment I can only copy all of the data contained in the text box with
the below code, can anyone add to this please?

Private Sub Label2_Click()
Dim MyData As DataObject
Set MyData = New DataObject
MyData.SetText TextBox1.Text
MyData.PutInClipboard
'wdapp.Selection.Copy
Set MyData = Nothing

'With Sheet10.TextBox1
' .SelStart = 0
' .SelLength = Len(TextBox1.Text)
' .Copy
' '.Shapes("TextBox1").Select Selection.Characters.Text
'End With
End Sub


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
copy selected part number of text from one cell into another cell orewa Excel Discussion (Misc queries) 1 April 11th 08 01:30 PM
Copy text cell & change text color conditionally manxman Excel Programming 2 August 31st 06 08:18 PM
text box insert in Excel - text box lines print on second copy Diana (Berry & Co) Excel Discussion (Misc queries) 0 July 26th 06 04:39 AM
open some txt files ,find text , copy the text before that to a single cell gus Excel Programming 2 July 11th 05 05:40 PM
Selecting text in cells & half of the Selected Text to be underLine Manish Singh Excel Programming 3 October 14th 04 07:34 PM


All times are GMT +1. The time now is 01:37 AM.

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"