Results 1 to 10 of 10
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Double-click a word (Word97/SR2)

    heh heh! This would HAVE to be a useful trick:


    I'd like to double-click on a word (string of text) in MSWord, have MSWord select the word, as it does now, but then have Word run a a MACRO procedure associated with the event.


    How often do I go through a document, like today, today wanting to STYLE selected words that I double-click, tomorrow I'd like to turn the words into {ASK} fields, Yesterday I wanted to write the words to an ASCII text file, .....

    Different day, different task/action, but always the same sequence - I want to double-click a word and perform some user-defined action on the selection.



    Of course, I could double-click (or single click) to identify the word, then drag myself up to the toolbar button hooked on to the flavour-of-the-day.

    There are short-cut keys, but then I'm doing the five-fingered-dance.

    All the techniques I can suggest involve boring and repetitive work - double-click-then-run-the-macro; I'd like the computer to understand that, right now, when I double-click , the macro is to be run.



    I've looked in VBA in my document object; all I see is New/Open/Close et al., all operating on the document.

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Double-click a word (Word97/SR2)

    Since you obviously have some extra time on your hands...

    How about a macro to preconfigure the document along the lines of
    For each Word in ActiveDocument
    Replace each word with a macrobutton field linked to temp macro and displaying the Word
    Next Word

    Then you can replace the temp macro with your macro du jour to get it to run
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Double-click a word (Word97/SR2)

    There's a "SelectionChange" events somewhere in the object model for currently supported versions of Word, but I find it hard to use, so I won't suggest that you start there. Instead, get a voice recognition program. Double-click and, using a commanding voice, order the computer to run your macro.

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Double-click a word (Word97/SR2)

    > For each Word in ActiveDocument

    You laugh! But you've given me something to think about on my drive across town this morning .....

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Double-click a word (Word97/SR2)

    > There's a "SelectionChange"

    Hmmm, it would have to be Selection.Change.After to be useful, since double-clicking selects the word on which I want to perform the action. Time to drag out the old XP drive again .....

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Double-click a word (Word97/SR2)

    <img src=/S/rofl.gif border=0 alt=rofl width=15 height=15> Ahem! "You WILL run my macro! No, you silly twit, THAT macro! Arrrggghh!!!" <img src=/S/rofl.gif border=0 alt=rofl width=15 height=15>
    Charlotte

  7. #7
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Double-click a word (Word97/SR2)

    Chris,
    If you upgrade to Office 2003 you can use the Application_GuessWhatIWantYouToDoButGuessBetterTha nThatStupidPaperclipDoes event. <img src=/S/grin.gif border=0 alt=grin width=15 height=15> Well, it might happen....
    You could use the SelectionChange event triggering an Application.Run statement together with a string variable that you set as necessary at startup (or whenever).
    Regards,
    Rory

    Microsoft MVP - Excel

  8. #8
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Double-click a word (Word97/SR2)

    > SelectionChange event triggering an Application.Run statemen

    Rory, you got me thinking:

    Perhaps if I placed all the text in a huge text box on a slightly-larger GUI form that filled my screen, then I could have a double-click event associated with the text box control, and grab the selected text and do-with-it-what-I-will?

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

    Re: Double-click a word (Word97/SR2)

    What a lovely idea! Notepad as a frontend for complex Word documents. Now, to get an idea of the formatting of the Word document, you could insert formatting codes like <bold> and <underline>. Of course, if the user changed these codes, the formatting of the document would have to change accordingly. Millions of Word users will be eternally grateful to you!

  10. #10
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Double-click a word (Word97/SR2)

    From a colleague:


    I love this editor. I don't know any other one that has this capability.

    The "clips", and clip writing abilities, which are similar to macros, only
    more powerful in some ways, are really cool too.

    I bought the Pro version ($20.00) a year ago and use it every day. The free
    version is good but it doesn't have the search & replace on disk feature.

    http://www.notetab.com

Posting Permissions

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