+ Reply to Thread
Results 1 to 2 of 2

Slight Problem

  1. #1
    Nick
    Guest

    Slight Problem

    I have the following code but when the cancel button on my input box is
    pressed the "invalid password" message is still displayed. Can someone help
    so when the cancel button is pressed then that is exactly what happens, the
    input box is cancelled.

    Dim MyStr1 As String, MyStr2 As String
    MyStr2 = ("engineering")
    MyStr1 = InputBox("Please Enter The Required Password")
    If MyStr1 = MyStr2 Then
    Sheets("Sheet2").Select
    Range("A9").Select
    Else
    MsgBox "Incorrect Password. Access Denied", vbCritical
    Range("E22").Select
    End If

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon Nick

    Enter this line immediately after the line that opens the InputBox:

    If MyStr1 = "" Then Exit Sub

    HTH

    DominicB

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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