Results 1 to 6 of 6

Thread: Selected text in activewindow??

  1. #1

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    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

  2. #2
    Addicted Member
    Join Date
    Jan 1999
    Posts
    239
    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



  3. #3
    Member
    Join Date
    Jan 2000
    Posts
    35
    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))

  4. #4

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527

    Sorry, I should have been more specific

    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)


  5. #5
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    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!!!
    Chemically Formulated As:
    Dr. Nitro

  6. #6

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    not what i would've liked, that was the last solution i had wanted but ehh...

    thanks




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width