LibreOffice 25.2 Help
오류가 발생한 후 오류 처리 루틴을 활성화하거나 프로그램 실행을 다시 시작합니다.
On [Local] Error {GoTo Labelname | GoTo 0 | Resume Next}
GoTo Labelname: 오류가 발생할 경우 "Labelname" 줄에서 시작하는 오류 처리 루틴을 활성화합니다.
Resume Next: 오류가 발생할 경우 오류가 발생한 문의 다음 문에서 프로그램 실행을 계속합니다.
GoTo 0: 현재 프로시저의 오류 처리기를 사용하지 않습니다.
Local: Optional. The keyword is a reminder the statement is local to the routine which invokes it; when the routine exits, this error handling is canceled automatically.
Sub ExampleReset
On Error GoTo ErrorHandler
Dim iNumber As Integer
Dim iCount As Integer
Dim sLine As String
Dim aFile As String
aFile = "C:\Users\ThisUser\data.txt"
iNumber = Freefile
Open aFile For Output As #iNumber
Print #iNumber, "This is a line of text"
Close #iNumber
iNumber = Freefile
Open aFile For Input As iNumber
For iCount = 1 To 5
Line Input #iNumber, sLine
If sLine <>"" Then
Rem
End If
Next iCount
Close #iNumber
Exit Sub
ErrorHandler:
Reset
MsgBox "All files will be closed", 0, "Error"
End Sub