Error Handling? (Runtime 75)
Hey,
I havn't been here for years, and i've only just now got Visual Basic back onto my computer for something different. I am just creating a little program to find and replace text. It's a very simple program, and I am having trouble finding how to handle the runtime error 75 that occurs. My command button loads a file into the RTC (Rich Textbox), and when the file doesn't exist I want it to give a Msg or similar, but it just errors and crashes. What do I need to put for the error handling??
Thanks in advance,
Matt
Re: Error Handling? (Runtime 75)
Code:
Private Sub Command1_Click()
On Error GoTo ErrorRoutine
' your code
Exit Sub
ErrorRoutine:
If Err.Number = 75 Then
' do what you want
End If
End Sub
Re: Error Handling? (Runtime 75)
A general error handler may look similar to this:
Code:
Private Sub Command1_Click()
On Error GoTo ErrHandler
'main code goes here
Exit Sub
ErrHandler:
'you may have select case err.Number here
'or Err.Clear
'you may also (if necessary) display message box with err.description (MsgBox Err.Description)
'and/or Resume or Resume Next
'and/or Exit Sub 'or function
'etc, etc, etc...
End Sub
Re: Error Handling? (Runtime 75)
Thanks guys, it helped heaps.
Re: Error Handling? (Runtime 75)
Additional reference http://www.vbforums.com/showthread.p...17#post3331617
Please don't forget to mark the thread as resolved if you have no follow-up questions.