+ Reply to Thread
Results 1 to 10 of 10

Halt automation until files are saved and closed by user.

  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Halt automation until files are saved and closed by user.

    Hello everyone. I have a series of Yes/No message boxes which pop up during an automation. The message boxes ask whether several files need to be updated. If the user selects yes, the file is Open. I need to correct the code so that the other submacros in the automation are halted, untill the selected files are closed (and saved at closing) by the user. After closing the file, the automation will then continue. Please see the code below for an example.

    Please Login or Register  to view this content.
    There are only 8 submacros in the automation.
    Last edited by AnthonyWB; 05-03-2010 at 04:25 PM. Reason: Corrections

  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,259

    Re: How to halt an automation untill an event occurs?

    Hello AnthonyWB,

    Please post all the macros. There is no other way to know the calling sequences.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Re: How to halt an automation untill an event occurs?

    I tried, and I exceeded the posting limit allowed on the forum. The other macros names are, however in order:

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Re: Halt automation until files are saved and closed by user.

    The main macro now uses the following procedures,

    Please Login or Register  to view this content.

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,980

    Re: Halt automation until files are saved and closed by user.

    I think this will be complicated to implement, not least because it will be complex to explain. Basically you would need variables declared WithEvents to monitor the workbooks and check when they were closed.
    It would, I think be far simpler to tell the user to update, save and close and then re-run the initial macro when ready.
    Everyone who confuses correlation and causation ends up dead.

  6. #6
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Re: Halt automation until files are saved and closed by user.

    Can you post some code that I can tinker with, I am willing to spend a day or two on it. I will however come up with a back up plan?

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,980

    Re: Halt automation until files are saved and closed by user.

    Do you need to ensure that the files are saved, or just that they have been closed? If the former, how do you cater for the user changing his/her mind?

  8. #8
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Re: Halt automation until files are saved and closed by user.

    If the user changes her mind their will be know harm in the file being saved and closed otherwise. So i would say yes the files need to be saved in order to capture any manual updates that were performed on the files.

  9. #9
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,980

    Re: Halt automation until files are saved and closed by user.

    My question is what if the user changes their mind and decides not to save? Do you continue, or exit?
    I confess I am somewhat reluctant to post the relevant code since if you don't understand it, you may tie yourself in knots trying to debug it. If you are prepared to accept the consequences, I'll knock something up.

  10. #10
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Re: Halt automation until files are saved and closed by user.

    I'll take the consequences. Good point, if the user changes her mind, for instance the update was done incorrectly? I'll cross that bridge later.

+ 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