Results 1 to 5 of 5

Thread: Msg Box stopping Macro from running
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    May 2018
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Msg Box stopping Macro from running

    Hi,

    I am looking for help with a Macro I created. The macro opens 12 other workbooks and copies dynamic data from each workbook. The issue I have is twofold, I created a Msg Box that tells the user "This Workbook will close in 15 mins" and then excel dialogue box opens up and asks me if I want "Save my changes" at the end of each workbook.

    So when I run the Macro, it open the workbook, the message box appear, I have to OK for it to move to the next phase and when I have completed my task within that workbook, excel asks “Do I want to Save the changes”, so I have to click No, Not to save any changes.

    So I have to click the through Macro 24 times for it to run correctly.

    It there any way I can I bypass these pop ups by using some code? Any help or suggestions are greatly appreciated.

    Rgd’s

  2. #2
    Board Regular Norie's Avatar
    Join Date
    Apr 2004
    Location
    Stirling, Scotland
    Posts
    75,154
    Post Thanks / Like
    Mentioned
    62 Post(s)
    Tagged
    6 Thread(s)

    Default Re: Msg Box stopping Macro from running

    You could temporarily disable events as these other workbooks are opened/closed.
    Code:
    Application.EnableEvents = False
    
    ' code to open/close workbooks and do stuff
    
    Application.EnableEvents = True
    If you want to stop the 'save changes' prompt either close the workbooks with SaveChanges:=False or temporarily disable alerts.
    If posting code please use code tags.

  3. #3
    MrExcel MVP Rick Rothstein's Avatar
    Join Date
    Apr 2011
    Location
    New Jersey, USA
    Posts
    35,244
    Post Thanks / Like
    Mentioned
    92 Post(s)
    Tagged
    33 Thread(s)

    Default Re: Msg Box stopping Macro from running

    Another option is to use the Status Bar for your messages... not as "visible" as MessageBoxes but they do not interfere with the flow of code...

    Application.StatusBar = "Hello"
    Rick's "mini" blog... http://www.excelfox.com/forum/f22/
    .
    Want to post a small screen shot? See Part B here.

  4. #4
    New Member
    Join Date
    May 2018
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Msg Box stopping Macro from running

    OK, folk's thank you for the response I shall try both options and get back to you

  5. #5
    New Member
    Join Date
    May 2018
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Msg Box stopping Macro from running..Solved

    Folk's sorry for the slow response. I have only been able to test your imputs today and they work perfectly. Thank you so much

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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