Err Function

ํ”„๋กœ๊ทธ๋žจ ์‹คํ–‰ ๋„์ค‘์— ๋ฐœ์ƒํ•œ ์˜ค๋ฅ˜๋ฅผ ์‹๋ณ„ํ•˜๋Š” ์˜ค๋ฅ˜ ์ฝ”๋“œ๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.

๊ตฌ๋ฌธ:

Err

๋ฐ˜ํ™˜ ๊ฐ’:

Integer

๋งค๊ฐœ ๋ณ€์ˆ˜:

Err ํ•จ์ˆ˜๋Š” ์˜ค๋ฅ˜์™€ ์ˆ˜์ • ์ž‘์—…์„ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ ๋ฃจํ‹ด์— ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.

์˜ˆ:

Sub ExampleError

on error goto ErrorHandler REM Set up error handler

Dim iVar as Integer

Dim sVar As String

REM Error occurs due to non-existent file

    iVar = Freefile

    Open "\file9879.txt" for Input as #iVar

    Line Input #iVar, sVar

    Close #iVar

Exit Sub

ErrorHandler:

    MsgBox "Error " & Err & ": " & Error$ + chr(13) + "At line : " + Erl + chr(13) + Now , 16 ,"an error occurred"

End Sub