I'm not sure about causing that error but there is a definite mistake in your 
code.  You must never ever never in a millions years or longer leave an event 
handler by Go To, you must do this by one of the provided methods, the most 
common of which is Resume Label (Resume ReDoHeaderEdit).  If you use goto then 
it assumes that all code from then on is part of the event handler and all 
sorts of odd things happen. Also, put an Exit Sub before the event handler so 
that you don't drop into it after the message box.

To be honest I never use Inputbox, it's too clunky, I'd rather use my own form, 
however, as far as I know it will only return a string variable, not an integer 
(although automatic conversion would work the way you have it).  If the user 
presses cancel then it returns a zero length string which you can detect and I 
suspect this is what's causing your error.  Change the code to return to a 
string variable, test that for zero length and prompt again if it is, then test 
it for being numeric, if it is assign it your integer otherwise prompt again.

Ian


  ----- Original Message ----- 
  From: HouseDad 
  To: [email protected] 
  Sent: Thursday, February 10, 2005 12:37 PM
  Subject: [vbhelp] Can you explain this simple phenomenon to me?



  Private Sub EditHeader()

  ReDoHeaderEdit:

  iSelection = 0

  On Error GoTo reporterror

  iselection=0

  iSelection = InputBox("Which line to change?")

  reporterror:
  If Err = 13 Then MsgBox "Please don't press CANCEL"

  GoTo ReDoHeaderEdit

  End Sub
  =================================

  This is basically what I am dealing with.  When the user first 
  presses cancel, the get the message in the reporterror area.  The 
  second time, there's a type mismatch on the input box line.  Why?  

  Is there another way to disable or ignore the cancel button on an 
  input box?  usually I have them in a do loop which ignores it fine 
  but with all the discussion about loops on here lately I thought I 
  would just try trapping the error.








  '// =======================================================
      Rules : http://ReliableAnswers.com/List/Rules.asp
      Home  : http://groups.yahoo.com/group/vbHelp/
      =======================================================
      Post  : [email protected]
      Join  : [EMAIL PROTECTED]
      Leave : [EMAIL PROTECTED]
  '// =======================================================



        Yahoo! Groups Sponsor 
              ADVERTISEMENT
             
       
       


------------------------------------------------------------------------------
  Yahoo! Groups Links

    a.. To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/
      
    b.. To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]
      
    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



[Non-text portions of this message have been removed]




'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [email protected]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to