+ Reply to Thread
Results 1 to 12 of 12

Auto close msg box

  1. #1
    Registered User
    Join Date
    11-04-2012
    Location
    Dundee,Scotland
    MS-Off Ver
    Excel 2010
    Posts
    35

    Auto close msg box

    Hi

    I am looking for a vba code to to close a message box after a few seconds. I can get it to work on one spreadsheet but not another. What would cause this?

    Thanks

    George

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Auto close msg box


    Hi,

    the code for sure …

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Auto close msg box

    Hello

    Something like this?

    Please Login or Register  to view this content.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Registered User
    Join Date
    11-04-2012
    Location
    Dundee,Scotland
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: Auto close msg box

    Quote Originally Posted by Fotis1991 View Post
    Hello

    Something like this?

    Please Login or Register  to view this content.
    Thanks, but that does not work for me. It stays open

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Auto close msg box

    Hi, dode,

    the code Fotis supplied is working fine for me (I used 3 seconds) - maybe consider to use a UserForm which could be released after the wanted time (timer would be started when UF is activated/initialized).

    This is a more detailed sample of the code supplied:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  6. #6
    Registered User
    Join Date
    11-04-2012
    Location
    Dundee,Scotland
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: Auto close msg box

    Quote Originally Posted by HaHoBe View Post
    Hi, dode,

    the code Fotis supplied is working fine for me (I used 3 seconds) - maybe consider to use a UserForm which could be released after the wanted time (timer would be started when UF is activated/initialized).

    This is a more detailed sample of the code supplied:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Thanks. Is there a setting somewhere I have to adjust to make it work. Both codes do work, but not on all of my workbooks. I'm a bit confused what the difference is

    Thanks

    George

  7. #7
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Auto close msg box

    A small example of what i suggested..
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-04-2012
    Location
    Dundee,Scotland
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: Auto close msg box

    Would it make a difference running on xp?

  9. #9
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Auto close msg box

    No. ................

  10. #10
    Registered User
    Join Date
    11-04-2012
    Location
    Dundee,Scotland
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: Auto close msg box

    I eventually got it to work. I'm not entirely sure why it wasnt working on all workbooks but when I opened another workbook and went back to the first one, it worked.

    Thanks for your help

    George

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

    Re: Auto close msg box

    The Popup method is not reliable in my experience so I'd be careful about relying on it. I'd always use a userform in preference, myself, as HaHoBe suggested.
    Everyone who confuses correlation and causation ends up dead.

  12. #12
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: Auto close msg box

    I think a small Userform is better as Hahobe and Rory already said.
    something like that....
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by john55; 04-07-2014 at 02:58 AM.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

+ 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. A macro to auto open and auto close a file with time schedule
    By billj in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-21-2015, 06:01 AM
  2. Auto open another WB and auto save and close
    By alfgrey in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-11-2014, 12:08 PM
  3. Auto Open and Auto Close Macro
    By SaleenaKhan in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-13-2013, 03:17 PM
  4. Can't edit macro with auto open and auto close.
    By lpete in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 12-03-2012, 07:25 PM
  5. Auto Excel workbook close: save= false during an auto subroutine
    By tomwashere2 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-16-2005, 02:05 AM

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