Search code examples
vb6exit

Is it possible to execute code after Exit Sub In vb6?


Is there anyway to execute code after exit sub? In the following code:

If Dir("C:\My Folder\myfile.dll") <> "" Then
   Exit Sub
End If

'Somecodehere etc

I tried to put the exit sub at the end of my whole code, but if the dll is detected, then exit sub doesn't work.


Solution

  • No, it is not possible to execute code after Exit Sub in VB6. Exit Sub means that the execution of the current Sub procedure stops at that point and returns to the calling code.

    If you want to execute some code after checking for the dll file, you can use an If-Else statement instead of Exit Sub. For example:

    If Dir(“C:\My Folder\myfile.dll”) <> “” Then 
        'Some code here if dll is detected 
    Else 
        'Some code here if dll is not detected 
    End If