Copy Textbox Text To Clipboard - Excel Help & Excel Macro Help
SEARCH ENTIRE SITE LOADING..

OZGRID Excel Help & Excel Best Practices Forums

Information Helpful? Why Not Donate.

SPECIALS PAGE FOR BARGAINS | BUILD YOUR GOLF SWING | FREE CUSTOM FUNCTIONS ADD-IN


Download Active Data For Excel Demo


Go Back Excel Help & Excel Macro Help > HELP FORUMS > EXCEL HELP
HOME Register Forum Help Calendar Search For Today's Posts Mark Forums Read

Reply

Copy Textbox Text To Clipboard

ANSWERS TO SIMILAR QUESTIONS
Copy Textbox Text To ClipboardCopy Textbox Text Into Another TextboxCopy Textbox Text When Cursor Moved From TextboxUserForm TextBox Paste From Clipboard



Javascript DHTML Drop Down Menu Powered by dhtml-menu-builder.com

Create Excel dashboards quickly with Plug-N-Play reports.


 
Thread Tools Search this Thread
Old March 22nd, 2007
Intelligent Converters
FREE DOWNLOADS
File/Password Recovery
markronz markronz is offline
I agreed to these rules
 
I'm a Spammer:
MS Office Version: 2003 English
Op System: Windows XP
Assumed Experience:
Join Date: 21st March 2007
English is 1st Language: Yes
Posts: 2 -- Threads: 2
Copy Textbox Text To Clipboard

Hello All-
I am just trying to copy the contents of a TextBox onto the clipboard so that the text can be pasted in a Word document or anywhere as just text.

My textbox is named:
Sheets("Type1").TextBox1

Any ideas how to accomplish this?

Thanks!
Print [Post / Thread] Reply With Quote
Old March 22nd, 2007
Aaron Blood's Avatar
Aaron Blood Aaron Blood is offline
OzMVP
 
I'm a Spammer:
MS Office Version: 2003
Op System: Windows XP
Assumed Experience: Excel Jedi
Join Date: 10th February 2003
English is 1st Language:
Location: Palm Beach, Florida
Posts: 1,580 -- Threads: 48
Re: Copy Textbox Text To Clipboard

In the past, I've used a backhanded approach with InputBox/SendKeys to quickly dump text to the clipboard. I'll share my trick with you if you promise not to tell anyone...

VB: AutoLinked keywords will cause extra spaces before keywords. Extra spacing is NOT transferred when copy/pasting, but IS if the keyword uses "quotes".
Sub TextCopy() Application.SendKeys ("^c~") InputBox "clipboard", , Sheets("Sheet1").TextBox1.Text End Sub


Sure, it works with your textbox but it's also kinda neat to remember for dumping strings in general to the clipboard.
__________________
Sub All_Macros(Optional control As Variant)

Last edited by Aaron Blood : March 22nd, 2007 at 04:37.
Print [Post / Thread] Reply With Quote
Old March 22nd, 2007
Intelligent Converters
FREE DOWNLOADS
File/Password Recovery
royUK royUK is offline
Publishes Private Messages
 
I'm a Spammer: YES
MS Office Version:
Op System: Windows XP
Assumed Experience: Poor (know the very basics)
Join Date: 26th January 2003
English is 1st Language:
Location: Lincolnshire,UK
Posts: 12,877 -- Threads: 67
Re: Copy Textbox Text To Clipboard

Here's another way
VB: AutoLinked keywords will cause extra spaces before keywords. Extra spacing is NOT transferred when copy/pasting, but IS if the keyword uses "quotes".
Dim objData As DataObject Dim strClipBoard As String Set objData = New DataObject ' Clears the clipboard objData.SetText "" objData.PutInClipboard ' Puts the text from an textBox into the clipboard strClipBoard = Me.TextBox1.Value objData.SetText strClipBoard objData.PutInClipboard ' Gets the text on the clipboard into a string variable objData.GetFromClipboard strClipBoard = "" strClipBoard = objData.GetText
Print [Post / Thread] Reply With Quote
Old March 22nd, 2007
Aaron Blood's Avatar
Aaron Blood Aaron Blood is offline
OzMVP
 
I'm a Spammer:
MS Office Version: 2003
Op System: Windows XP
Assumed Experience: Excel Jedi
Join Date: 10th February 2003
English is 1st Language:
Location: Palm Beach, Florida
Posts: 1,580 -- Threads: 48
Re: Copy Textbox Text To Clipboard

I believe you only expose the DataObject if you already have a userform open in your app. Which in this case... I had not detected.
__________________
Sub All_Macros(Optional control As Variant)

Last edited by Aaron Blood : March 22nd, 2007 at 04:59.
Print [Post / Thread] Reply With Quote
Old March 22nd, 2007
Intelligent Converters
FREE DOWNLOADS
File/Password Recovery
royUK royUK is offline
Publishes Private Messages
 
I'm a Spammer: YES
MS Office Version:
Op System: Windows XP
Assumed Experience: Poor (know the very basics)
Join Date: 26th January 2003
English is 1st Language:
Location: Lincolnshire,UK
Posts: 12,877 -- Threads: 67
Re: Copy Textbox Text To Clipboard

I thought the OP was talking about a TextBox on a UserForm, I didn't notice the sheets reference.

Last edited by royUK : March 22nd, 2007 at 05:30.
Print [Post / Thread] Reply With Quote
Reply Lifetime Upgrade To Ad Free Styles

   « PREVIOUS Reading Querytable Parameters With Sourcerange || Order Of For Each NEXT »
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +9. The time now is 23:58.


Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Ozgrid is Not Associated With Microsoft. Ozgrid Retains the Rights to ALL Posts and Threads