Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Copying the text from a text box to the clipboard

Why doesn't this work?
..................................
Private Sub CommandButton1_Click()
UserForm1.TextBox1 = "hi"
UserForm1.TextBox1.Copy
UserForm1.TextBox2.Paste
'why doesn't textbox2 contain "hi"?
End Sub
....................................

Thanks

Tony

ps it says in help:
..................................
Copy Method
Copies the contents of an object to the Clipboard.
<snip
On a TextBox or ComboBox, it copies the currently selected text.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copying the text from a text box to the clipboard

Copy copies the selected text - you don't have any text selected:

Private Sub CommandButton1_Click()
With UserForm1
..TextBox1 = "hi"
..TextBox1.SelStart = 0
..TextBox1.SelLength = Len(TextBox1.Text)
..TextBox1.Copy
..TextBox2.Paste
End With
End Sub

works.

But this is easier:


Private Sub CommandButton1_Click()
With UserForm1
..TextBox1 = "hi"
..TextBox2.Text = .Textbox1.Text
End With
End Sub

--
Regards,
Tom Ogilvy


TonyJeffs wrote in message
om...
Why doesn't this work?
.................................
Private Sub CommandButton1_Click()
UserForm1.TextBox1 = "hi"
UserForm1.TextBox1.Copy
UserForm1.TextBox2.Paste
'why doesn't textbox2 contain "hi"?
End Sub
...................................

Thanks

Tony

ps it says in help:
.................................
Copy Method
Copies the contents of an object to the Clipboard.
<snip
On a TextBox or ComboBox, it copies the currently selected text.



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
copying text within a text box and losing formatting hokiefan1us Excel Discussion (Misc queries) 2 September 17th 08 08:41 PM
Pasting delimited text from clipboard directly into Excel Spreadsh Anexceluser New Users to Excel 2 February 11th 07 01:57 AM
Truncated text when copying text from one excel doc to another sunny pete Excel Discussion (Misc queries) 3 August 12th 05 02:11 PM
Pasting from clipboard-how to control text-to-columns delimiting stebro Excel Discussion (Misc queries) 1 June 15th 05 05:31 PM
Text not copying as text from Word to Excel 2003 Christine Excel Discussion (Misc queries) 4 March 3rd 05 11:33 PM


All times are GMT +1. The time now is 09:48 PM.

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"