Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy selected part number of text from one cell into another cell | Excel Discussion (Misc queries) | |||
Copy text cell & change text color conditionally | Excel Programming | |||
text box insert in Excel - text box lines print on second copy | Excel Discussion (Misc queries) | |||
open some txt files ,find text , copy the text before that to a single cell | Excel Programming | |||
Selecting text in cells & half of the Selected Text to be underLine | Excel Programming |