Results 1 to 4 of 4

Need Macro to Stop and Show Message When Error, or Continue

Threaded View

  1. #1
    Forum Contributor
    Join Date
    06-10-2005
    MS-Off Ver
    2007
    Posts
    223

    Need Macro to Stop and Show Message When Error, or Continue

    Hi,
    I have a macro that correctly stops and shows a message box when there is an error opening a file (if the wrong password was used). But when the correct password is used, the file opens and the macro stops instead of continuing. Here is what I have:

    On Error GoTo ErrMsg
        Workbooks.Open Filename:= _
            "T:\MacroFile.xlsx", Password:=Sheet4.Range("B3").Value
        Range("A1").Select
    Exit Sub
    
    ErrMsg:
    MsgBox ("The password is incorrect." & vbLf & "Type the correct password in cell B3 and try again."), , "ALERT!!!"
    
    additional macro tasks follow
    Any suggestions would be appreciated.

    Thanks,

    Phillycheese
    Last edited by Phillycheese5; 10-23-2018 at 01:24 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] If cell is empty in a variable range, stop macro and return error message
    By Andrei Kononenko in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-22-2019, 02:19 PM
  2. Replies: 5
    Last Post: 12-08-2016, 06:43 PM
  3. [SOLVED] pause macro and show message box to click on it to continue
    By Megatronixs in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 03-26-2014, 04:49 PM
  4. Stop a Macro if Criteria not met and Show Error Message
    By m3hool in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-17-2013, 10:12 AM
  5. [SOLVED] Setting up if cell is blank don't continue... and show a message.
    By Cyberpawz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-16-2012, 10:04 AM
  6. VBA Code to continue in Update Links error message
    By dcgrove in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-21-2011, 03:53 PM
  7. [SOLVED] Macro Pause, show message, continue
    By davegb in forum Excel General
    Replies: 3
    Last Post: 02-11-2005, 01:06 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