The StartMode setting in the Options dialog of the Tools menu in VB4determines only whether an application with no startup form continues torun after Sub Main has completed. This allows testing of OLE Automationservers. But the StartMode property of the App object allows you to determinein code whether an application shows any visible interface to users. Asingle VB executable file can be both an invisible server and a normalapplication, just like Excel. The Sub Main procedure lets you test thevalue of App.StartMode to decide whether or not to show a form. If theapplication is started directly by a user, the StartMode is vbSModeStandalone.If started by a client application, the StartMode is vbSModeAutomation.
Sub Main If App.StartMode = vbSModeStandalone Then frmMain.Show Else 'OLE server action... End If