Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 2nd, 2006, 02:55 AM
Registered User
 
Join Date: Sep 2006
Location: Karachi, , Pakistan.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Copy text to win Clipboard

Is there is anyway (i m sure, there is) to copy the text of Textbox to Clipboard.. ? So, as the text can be pasted in any other softwrae l

please let me know

Learn from the mistakes of others. You can't live long enough to make them all yourself
  #2 (permalink)  
Old October 2nd, 2006, 03:00 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: India.
Posts: 224
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to ashu_from_india Send a message via Yahoo to ashu_from_india
Default

    Clipboard.Clear
    Clipboard.SetText Text1.Text, vbCFText

  #3 (permalink)  
Old October 2nd, 2006, 03:29 AM
Registered User
 
Join Date: Sep 2006
Location: Karachi, , Pakistan.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Your code simply result in Error...'424 Object Required'

Well i want to make a confession here that i really missed to mention:
1. That i am a newbie, so plz be more descriptive
2. That i have placed a command button, clicking to which will copy the text to the clipboard just like Ctrl+C does...

Learn from the mistakes of others. You can't live long enough to make them all yourself
  #4 (permalink)  
Old October 2nd, 2006, 08:37 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: India.
Posts: 224
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to ashu_from_india Send a message via Yahoo to ashu_from_india
Default

Option Explicit

Private Sub Command1_Click()
    Clipboard.Clear
    Clipboard.SetText Text1.Text, vbCFText
End Sub

r u writing it like this???
coz its a tested code n it works for me


  #5 (permalink)  
Old October 5th, 2006, 12:19 AM
Registered User
 
Join Date: Sep 2006
Location: Karachi, , Pakistan.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

anyways i got the sol from another guy at another website... for the benefit of everybody... here is the code:

Private Sub CommandButton1_Click()
       With Me.OLEObjects("TextBox1").Object
           .SelStart = 0
           .SelLength = Len(TextBox1.Text)
           .Copy
       End With
End Sub

Learn from the mistakes of others. You can't live long enough to make them all yourself
  #6 (permalink)  
Old October 5th, 2006, 06:02 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: India.
Posts: 224
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to ashu_from_india Send a message via Yahoo to ashu_from_india
Default

m using VB6 with SP6...
and when i run this code..i get msg tht Method or Data Member not found

whts this OLEObjects???

bcoz its giving error here



  #7 (permalink)  
Old October 5th, 2006, 06:04 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: India.
Posts: 224
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to ashu_from_india Send a message via Yahoo to ashu_from_india
Default

r u using any reference

bcoz the code tht i gave works without including any reference



Similar Threads
Thread Thread Starter Forum Replies Last Post
Drop Changes or Copy to clipboard JezLisle Access VBA 4 November 20th, 2008 10:24 AM
Copy Metafile to the Clipboard TMA_Master BOOK: Visual Basic 2008 Programmer's Reference ISBN: 978-0-470-18262-8 1 August 26th, 2008 10:59 PM
Copy to clipboard in EMF format. watashi C# 1 April 17th, 2008 09:02 AM
how to copy text in a word file on the clipboard donrafeal Word VBA 3 February 1st, 2007 12:32 AM
Copy to Clipboard Clive Astley Access 5 July 16th, 2004 07:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.