how do i get the selected text, in the active window,
also how do i get all the text in the active window.
any help would be appreciated
Printable View
how do i get the selected text, in the active window,
also how do i get all the text in the active window.
any help would be appreciated
if the text were in a text box:
'First clear the clipboard
Clipboard.Clear
'Select Text in txtBox & copy to clipboard
Clipboard.SetText txtBox.Text, vbCFText
'''''''''''''''''''''''''''''''''''''''''''
to paste it back or to another text box
txtBox.Text = Clipboard.GetText
If you are talking about an mdi interface then:
'on the main form
str_myVariable = Me.ActiveForm.rtfText.seltext
'for all the text
str_myVariable = mid(Me.ActiveForm.rtfText.text,1,len(Me.ActiveForm.rtfText.text))
Sorry, I should have been more specific
I know how to do all of that,
but what I was after is the selected text, in an application that is not "mine". Say if in microsoft word, they used a hot key, to activate my program, it would show the selected text in the active window (i.e. Microsoft Word)
Do an activate on whatever window using "Appactivate".
Then use (not sure about the syntax - you can look up in help):
Sendkeys "^{C}",True
Make sure uppercase "C".
Basically copy to clipboard.
Guarantee to work!!!
not what i would've liked, that was the last solution i had wanted but ehh...
thanks