|
-
Nov 20th, 2007, 10:12 PM
#1
Thread Starter
Hyperactive Member
Cut Copy Paste Text
The problems I am facing is that I need to know the characters which are highlighted for copying. I want to get them. Also I need to know how to paste characters since sending the keys does not work as pasting it works just like you were pressing the keys. I need to paste them, not send them.
-
Nov 21st, 2007, 03:07 AM
#2
Re: Cut Copy Paste Text
 Originally Posted by lone_REBEL
The problems I am facing is that I need to know the characters which are highlighted for copying. I want to get them. Also I need to know how to paste characters since sending the keys does not work as pasting it works just like you were pressing the keys. I need to paste them, not send them.
not sure coping from where and past to where
Below code copy selected text in text1 and past it in Text2
Code:
Option Explicit
Private Sub Command1_Click()
'Copy
Me.Text1.SelStart = 2
Me.Text1.SelLength = 5
VB.Clipboard.Clear
VB.Clipboard.SetText Me.Text1.SelText
'Past
Me.Text2.Text = VB.Clipboard.GetText
VB.Clipboard.Clear
End Sub
-
Nov 21st, 2007, 04:29 AM
#3
Thread Starter
Hyperactive Member
Explaination
I need my code to work globally, for all applications not just my own form. I mean it should work O.K. to get the highlighted text in a notepad window and pasting it in a wordpad window. Bringing the window to front or giving it the focus is not the problem.
I mean I create a hotkey for my app and whenever that hotkey is pressed while any window is in the focus, my program should tell what text has been highlighted and if another hotkey is pressed, it should paste the text in the clipboard. Creating the hotkeys is not required in this problem, only getting and pasting the selected text.
-
Nov 21st, 2007, 04:48 AM
#4
Re: Cut Copy Paste Text
You can use,
Code:
Clipboard.clear
SendMessage (Notepad Edit Window Handle here, WM_COPY,0,0)
This will copy the selected text in the note pad to clipboard
Not sure hwo to past in to the word doucment.
but to past in to a text box, as stated in my first post,
me.text1.text=clipboard.gettext
-
Nov 21st, 2007, 04:57 AM
#5
Re: Cut Copy Paste Text
i forget,
you can also use the following on external applications. but not sure about word.
Code:
SendMessage (destination edit / text box handle here,wm_past,0,0)
above code will past the clipboard text in to a text or edit control window in your own or in an external application.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|