+ Reply to Thread
Results 1 to 2 of 2

How do I move focus from User Form back to Word Doc?

  1. #1
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2019
    Posts
    163

    Smile How do I move focus from User Form back to Word Doc?

    Hello, On MS-Word (2003),
    1. I'm building a macro that uses a User Form to interact with the user (several times), asking the user to select text (or a line) and then return to the Form and hit OK. This goes back & forth between the Form and the Doc several times.
    2. Everytime the user returns back to the Doc to select the next batch of text or line, he/she has to click on the Doc window 1-time to give it the FOCUS, then click again to make the text or line selection.
    3. Sometimes this is confusing. They may click only 1-time and think they made a line selection, but they really didn't (they only made the initial FOCUS change, and didn't really make the intended range selection).
    4. Question: Within the VBA code, is it possible to automatically move the FOCUS from the User Form to the Doc Window for the user? So, when the user clicks on the Doc the 1st time, he/she is selecting text (line) on the 1st mouse selection.
    I can't find any way to move FOCUS from a User Form (that was just shown) back to the Document (and away from the User Form). Do you have any ideas on how to do this???

    Figured My Own Solution: Use following SendKeys code (see below). This sends focus back to the main Word Window. Found this key combination in the exhaustive list of HotKey Tips from MS Help. Tested and works even if other Word docs are open or if other application programs are running at the same time.
    Please Login or Register  to view this content.
    Last edited by sauerj; 11-10-2010 at 09:30 AM. Reason: Worked out my own solution!

  2. #2
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2019
    Posts
    163

    Smile Re: How do I move focus from User Form back to Word Doc?

    Found My Own Solution: Details added to bottom of main post above! ... sauerj

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1