+ Reply to Thread
Results 1 to 6 of 6

Mouse Focus Changes After Script Runs

  1. #1
    Registered User
    Join Date
    09-29-2008
    Location
    Australia
    MS-Off Ver
    Excel 2007 Under Vista
    Posts
    10

    Mouse Focus Changes After Script Runs

    Hi

    I have an annoying issue that occurs after running a reasonably long script involving a number of spreadsheets. The script all runs fine and leaves 4 output spreadsheets open for final manual formatting. However the mouse focus is changed by the script (somehow?) and no matter what I do the mouse wants to multi select cells. Clicking in a single cell always selects at least 3 or 4 cells and sometimes the whole column.

    The only place in the code where I set any rules realted to selection is to set a file dialog to allow multi selection of files. That is

    Please Login or Register  to view this content.
    I have tried resetting this flag after to be false but it has no effect on the mouse behaviour.

    As the script accesses up to 12 spreadsheets and copies, pastes and appends between sheets I do use global variables for the workbooks, passing them into private functions. I clear all the global variables to free the memory at the end of the script. This doesn't have any effect on the mouse behaviour.

    Though this is not necessarily a show stopper it is inconvenient for users to be left with a mouse that always multi selects cells, especially as the script leaves the sheets in a stage for final cell adjustments to be made.

    Any one got any ideas as to why this might be happening and how it might be fixed?

    Cheers
    Clive
    Last edited by ClivePoole; 12-17-2008 at 08:27 PM. Reason: Solved

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Clive,

    After you paste, the cells that were pasted will remain selected. To release the them add this line of code to the end of your macro (the one that does the pasting)...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    09-29-2008
    Location
    Australia
    MS-Off Ver
    Excel 2007 Under Vista
    Posts
    10
    Thanks for the reply. I have done this but still the behaviour persists. Here is the last module that selects any cells before the script exits. Each worksheet in turn is passed into this Routine and then exits. This is the offending module as one of the sheets I noticed was not being passed in and does not exhibit the behaviour. Any comments appreciated.

    Please Login or Register  to view this content.

    Cheers
    Clive

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Clive,

    Would it be possible for you to post the workbook for review? It would be faster to trace the problem with the entire workbook. If you are using Excel 2007, please provide a copy in Excel 2003 format as well.

    Sincerely,
    Leith Ross

  5. #5
    Registered User
    Join Date
    09-29-2008
    Location
    Australia
    MS-Off Ver
    Excel 2007 Under Vista
    Posts
    10
    Leith
    uH OH ok.

    This is my first VBA script and the code is well ugly but I do need to solve this so yes.

    I have attached a zip file that contains the Spreadsheet with the Macro which runs from assigned images. I have also attached the spreadsheets which are the template as well as the input CSv files to the third of the Macros where the problem occurs RunFormatTxt.

    Happy if you get a chance to delve into this and I am also prepared for your comments about my sloppy code.

    Cheers
    Clive
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    09-29-2008
    Location
    Australia
    MS-Off Ver
    Excel 2007 Under Vista
    Posts
    10
    Leith

    Perhaps this is actually a bug.

    I have found that other people are experiencing this behaviour in Excel 2007. I don't think now that it is a consequence of my code. See link for another discussion.

    http://www.tech-forums.net/pc/f9/mic...89/index2.html

    Cheers
    Clive

+ 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