title: How to detect if user select cancel InputBox VBA Excel
body: <p>I have an input box asking user to enter a date. How do I let the program know to stop if the user click cancel or close the input dialog instead of press okay.</p>
  
  <p>Something like
  <code>if str=vbCancel then exit sub</code> </p>
  
  <p>Currently, user can hit OK or Cancel but the program still runs </p>
  
  <p><code>str = InputBox(Prompt:="Enter Date MM/DD/YYY", _
            Title:="Date Confirmation", Default:=Date)</code>
  <img src="https://i.stack.imgur.com/1fjRL.png" alt="enter image description here"></p>