Results 1 to 10 of 10
  1. #1
    New Lounger
    Join Date
    Jan 2003
    Location
    Tulsa, Oklahoma, USA
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Select text/toggle? (Word2000)

    I have a secretary who says there's a way to select text in a document, and then toggle it in some way so that all the text EXCEPT what she had previously selected is now selected (like, if she wanted to delete everything but what she had previously selected). She says she can't remember how to do it and I've never heard of it before. Does anyone know how to do this magical thing? Thanks....
    Cyndie Browning
    GableGotwals
    Tulsa, OK

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Select text/toggle? (Word2000)

    As far as I know, this is not a built-in feature of Word. If you select some text in the middle of a document, its "negative" would consist of two disjunct parts. Selection of non-contiguous text was introduced in Word 2002, I think.

    As far as deleting everything but the selected text is concerned, she could do it in a few steps:
    - Copy the selected text to the clipboard (Ctrl+C)
    - Select the entire document (Ctrl+A)
    - Delete the text (Delete or Backspace)
    - Paste the text from the clipboard (Ctrl+V)

    This could be made into a macro and assigned to a toolbar button and/or keyboard shortcut if it is used often:

    Sub DeleteAllButSelection()
    With Selection
    .Copy
    .WholeStory
    .Delete
    .Paste
    End With
    End Sub

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select text/toggle? (Word2000)

    Hi Cyndie:
    She may have been thinking of Windows Explorer where you can select some files & then click Edit/Invert Selection. But not with text, as far as I know.

  4. #4
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select text/toggle? (Word2000)

    Hans,

    Would I be right in assuming that the actions of your DeleteAllButSelection() macro could not be undone (at least by the Undo menu command)?

    Alan

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select text/toggle? (Word2000)

    Hi Alan:
    No. I tried it & could undo steps 1 by 1.

  6. #6
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select text/toggle? (Word2000)

    Hi Phil

    That's good to know for a macro like this, but I'm always wary of not being able to undo parts or all of a macro. Is there any way to tell, apart from trying it out? I guess in Hans' code everything corresponds to a menu command, but what about VBA that has no direct counterpart in the application's built-in commands?

    Alan

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Select text/toggle? (Word2000)

    I haven't tried it exhaustively, but in my experience, you can undo almost everything a macro does to a document. There is an obvious exception: you can't undo saving a document, but that is the same as when you are working interactively.

    (Rant: why doesn't Excel have this capability?)

  8. #8
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select text/toggle? (Word2000)

    Thanks Hans. Come to think of it, it may have been macros in Excel that made me "conscious of" Undo. I saw a fairly simple bit of code that enables an Undo in XL for any operation done on a range of cells. In essence, it captures the cell addresses and contents into an array before the macro runs, and these can be replaced from the array by an Undo command. But I wonder how this method would cope with storing an undo "history"; indeed, whether it could be adapted to do so???

    Alan

  9. #9
    New Lounger
    Join Date
    Jan 2003
    Location
    Tulsa, Oklahoma, USA
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Select text/toggle? (Word2000)

    Thanks for taking the time to reply. Our document management system (Worldox) allows us to invert our selection, too---"selecting the negative," as it were---but I thought I ought to run the possibility in Word by y'all in case I'd missed something. Thanks again....
    Cyndie Browning
    GableGotwals
    Tulsa, OK

  10. #10
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select text/toggle? (Word2000)

    Hi Alan:
    I'm glad Hans was able to answer your question, as I'm not a VBA expert. I just wanted to mention that I've never had trouble experimenting with macros. I just create a new document, add whatever I need to test, & put the macro in the document. When I'm done, I just delete the macro & I don't have to worry about bloating normal.dot.
    Cheers,

Posting Permissions

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