+ Reply to Thread
Results 1 to 3 of 3

Keyboard clicks stop current process then resumes with next line of code

  1. #1
    Registered User
    Join Date
    08-17-2012
    Location
    Chicago, IL
    MS-Off Ver
    Office 365
    Posts
    35

    Keyboard clicks stop current process then resumes with next line of code

    I'm looking for guidance from the experts. I've created a macro that brings in 4 individual raw files and does some complicated processes to complete. It has been working fine. However, the more you give them, the more they want and the users continue to start with larger and larger base files.

    Here's the problem I see happening: if while the macro is running, the user clicks on the window or hits the enter key, the process running just stops where it's at (in a vlookup or index/match) and drops down to the next line of code and continues along it's merry way. What this results in is an incomplete ending document with missing data. I've tried to disable screen updating but no one likes that because they rather see that something is happening. I have made sure the progress bar is visible so that they see that calculating is being done. But even I who knows that is happening, clicks anyway to check email or something.
    Some of these run 20-30 minutes so no one wants to stare at a screen for that long.

    I've seen some references to DoEvents but I don't know if that is the answer and where/how would I use it. Is there some other way for mouse/keyboard actions to not affect the running of the macro?

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Keyboard clicks stop current process then resumes with next line of code

    You might add
    Please Login or Register  to view this content.
    to the start of the code and reset to True at the end.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    08-17-2012
    Location
    Chicago, IL
    MS-Off Ver
    Office 365
    Posts
    35

    Re: Keyboard clicks stop current process then resumes with next line of code

    Thank you!! This works for me. I have modified the Add-in and shipped it off to the users to see how it works for them.

    One thing to note for others who may try this solution. Whatever window status you have when you start the macro will be locked until it completes so you may want to address that with the users if they don't want a full screen being locked. Secondly, I did have user input required at the beginning of the macro so I didn't add that line of code until all the files were imported. And then turned it off at the end. I also have a Msg line at the very end indicating that the macro has completed running.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA macro
    By usama5788 in forum Excel General
    Replies: 1
    Last Post: 06-15-2017, 02:39 PM
  2. Excel 2007 macro won't run after record and stop process---help
    By DataDealer_007 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-26-2012, 09:47 AM
  3. need a formula that speeds up my current complex process!
    By schueyisking in forum Excel General
    Replies: 4
    Last Post: 09-04-2008, 10:59 AM
  4. telling the code to stop at line breaks
    By Kavy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-25-2007, 04:45 PM
  5. is there a command to stop the calculating process
    By carsto in forum Excel General
    Replies: 2
    Last Post: 11-28-2006, 05:11 PM
  6. [SOLVED] What causes my number pad on my keyboard to suddenly stop functio.
    By Tennessee in forum Excel General
    Replies: 1
    Last Post: 03-24-2005, 09:06 PM
  7. [SOLVED] Macro that waits, then resumes after window is closed
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-16-2005, 12:06 PM

Tags for this Thread

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