|
-
June 20th, 2002, 01:08 AM
#3
Banned
The goto command jumps to another section of code, mostly on errors, heres an example from the MSDN library:
Private Sub Command1_Click()
Dim source As String
Dim target As String
On Error GoTo err_handler
source = "c:\test.txt"
Open source For Output As #1
Write #1, "This is a test."
Close #1
target = "a:\test.txt"
If Dir(target) <> "" Then Kill target
FileCopy source, target
Exit Sub
err_handler:
If Err.Number = 70 Then
MsgBox "Permission denied. Please remove write-protection."
Resume
ElseIf Err.Number = 71 Then
MsgBox "Disk not ready. Please insert a disk."
Resume
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|