+ Reply to Thread
Results 1 to 6 of 6

Need MsgBox in On Error

  1. #1
    Registered User
    Join Date
    09-21-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    21

    Need MsgBox in On Error

    Hi,

    I have a code that loops through a range, opening workbooks and copying them over. In some cases the workbook names in the loop will not exist. I'd like a message box to pop up with "File not Found" should this even occur, but I don't know where to put it with the On Error statement. Here's what I have, can someone help me by adding the message box?
    Please Login or Register  to view this content.
    Thanks

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Need MsgBox in On Error

    hi DAK266,

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Need MsgBox in On Error

    on the other hand what is the purpose of the message box if on OK click the code would continue. It would be more logical to collect all errors and show msgbox on code completion with processing results

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Need MsgBox in On Error

    Hi DAK266

    Modify your Code to this
    Please Login or Register  to view this content.
    and add this Function
    Please Login or Register  to view this content.
    John

    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.

  5. #5
    Registered User
    Join Date
    09-21-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Need MsgBox in On Error

    Jaslake, thank you--it worked perfectly!

    Watersev, thanks for the suggestion--I already have that logic in the actual worksheet.

    Thank you both for the help.

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Need MsgBox in On Error

    You're welcome...glad I could help.

+ 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] How to make an error come up as a msgbox
    By Lee_wwfc in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-23-2013, 01:33 PM
  2. error with MsgBox
    By ramserp in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-10-2009, 06:39 AM
  3. msgbox appear with error msg
    By jrd269 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-02-2005, 12:05 PM
  4. [SOLVED] msgbox on error
    By Ciara in forum Excel General
    Replies: 6
    Last Post: 05-26-2005, 05:15 PM
  5. MsgBox Code Error
    By MBlake in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-02-2005, 07: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