+ Reply to Thread
Results 1 to 8 of 8

Stopping a macro while a file is open - Then resuming once it is saved/closed

  1. #1
    Registered User
    Join Date
    02-15-2013
    Location
    Halesite, New York
    MS-Off Ver
    Excel 2010
    Posts
    39

    Stopping a macro while a file is open - Then resuming once it is saved/closed

    Folks, hope you can help.

    Trying to set something up in the Workbook_Open routine, that will open up a file, but stay there, while it is open until the person saves and closes it.

    Once that is done, then the macro continues on its merry way.

    I have a thought, but it is not clicking. I wanted to get another set of brain waves on it - to see if a better answer comes to the surface.

    Cheers,

    Gary Harding
    Halesite, NY

    PS - here is some of the code...


    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    11-13-2013
    Location
    United States
    MS-Off Ver
    2010
    Posts
    147

    Re: Stopping a macro while a file is open - Then resuming once it is saved/closed

    What about using a Workbook_BeforeClose () subroutine to run the second part of your code?

  3. #3
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Stopping a macro while a file is open - Then resuming once it is saved/closed

    Can you put the first half in the workbooks open event and then the second half in the workbook_close event?
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  4. #4
    Registered User
    Join Date
    02-15-2013
    Location
    Halesite, New York
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Stopping a macro while a file is open - Then resuming once it is saved/closed

    The macro is not the file that opens up. The data on that file is being placed there from another source.

    I want the user to make changes and alterations, before the rest of the macro will access that file, and do its gyrations.

    The people that are using the file are not the savviest folks, so I wanted them to just save and close the file.

    Is it possible to set a PF Key or something to continue the macro, or open a form?

  5. #5
    Forum Contributor
    Join Date
    11-13-2013
    Location
    United States
    MS-Off Ver
    2010
    Posts
    147

    Re: Stopping a macro while a file is open - Then resuming once it is saved/closed

    I am sure there are multiple ways to accomplish what you want to do. Here is my suggestion:

    In the Approval Report spreadsheet put this code in a Module

    Please Login or Register  to view this content.
    You may have to put the full path and filename in there.

    In the original file that has the Workbook_Open code, put this

    Please Login or Register  to view this content.
    Basically, you are calling the second part of the Macro from the Approval Report prior to that report closing.

    Hope this helps.

  6. #6
    Registered User
    Join Date
    02-15-2013
    Location
    Halesite, New York
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Stopping a macro while a file is open - Then resuming once it is saved/closed

    ImStevenB - almost. I am going to 'recall' that file to use in the rest of the macro. So that may not work. But you have got me heading in a direction. Thanks!

    I will try something tonight, and see if I can do it.

  7. #7
    Registered User
    Join Date
    02-15-2013
    Location
    Halesite, New York
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Stopping a macro while a file is open - Then resuming once it is saved/closed

    I got it.... I set up a PF Key that would open a procedure that would save and close the file, before bringing up the form.

    Thanks Steve for the help - it steered me in the right direction.

    Have a great day!

    Gary

  8. #8
    Forum Contributor
    Join Date
    11-13-2013
    Location
    United States
    MS-Off Ver
    2010
    Posts
    147

    Re: Stopping a macro while a file is open - Then resuming once it is saved/closed

    Awesome! Glad you got it!

    Steve

+ 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. [SOLVED] Need to auto sort column when file is saved/closed
    By jingles9 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-19-2013, 01:44 PM
  2. [SOLVED] VB to open a file, input on a file and close again, with NO macros/vb saved to file
    By unreal_event_horizon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-05-2012, 11:41 AM
  3. Macro: SaveAs: how to keep file open after saved?
    By trillium in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-08-2010, 04:38 PM
  4. Macro to open/close a file only if it isn't already opened/closed
    By catccc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-24-2010, 10:27 AM
  5. Excel macro to Start Word and open latest saved file.rtf
    By BHudPE in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-09-2010, 10:45 PM

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