Only One Instance
The following code snippet avoids an application to run a separated instance. This code must preceed any other command and preferably be executed before any other module is loaded.
Private Sub Form_Load()
If App.PrevInstance = True Then
MsgBox "Application already running.", vbInformation, App.Title
Unload Me
Exit Sub
End If
End Sub
page revision: 6, last edited: 13 Apr 2008 03:36