J
Jay
Hi -
Can a main procedure that calls a subroutine be terminated from within the
subroutine?
For example, the following demonstrates a main procedure calling a
subroutine that opens the FileDialog object. If the user presses [Cancel]
without selecting a file, the subroutine executes the 'Exit Sub' statement
and control passes back to the main procedure where execution continues. Is
there a replacement statement for the Exit Sub that would terminate the
subroutine and the calling procedure at the same time?
----------
Thanks,
Jay
Sub main()
mySubroutine
test = 1
End Sub
Sub mySubroutine()
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
If .Show = -1 Then
strSourceFile = .SelectedItems(1)
Else
MsgBox "No input file selected; import canceled."
Exit Sub
End If
End With
End Sub
------------
Can a main procedure that calls a subroutine be terminated from within the
subroutine?
For example, the following demonstrates a main procedure calling a
subroutine that opens the FileDialog object. If the user presses [Cancel]
without selecting a file, the subroutine executes the 'Exit Sub' statement
and control passes back to the main procedure where execution continues. Is
there a replacement statement for the Exit Sub that would terminate the
subroutine and the calling procedure at the same time?
----------
Thanks,
Jay
Sub main()
mySubroutine
test = 1
End Sub
Sub mySubroutine()
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
If .Show = -1 Then
strSourceFile = .SelectedItems(1)
Else
MsgBox "No input file selected; import canceled."
Exit Sub
End If
End With
End Sub
------------