防止程序重复加载的简方法
将以下代码 插入主窗口的代码中:
Private Sub Form_Load()
Call CheckExist(Me)
End Sub
Public Sub CheckExist(fm As Form)
Dim title As StringIf App.PrevInstance Then
title = App.titleCall MsgBox("这程式已执行", vbCritical)
App.title = "" '如此才不会Avtivate到自己
fm.Caption = ""
AppActivate title 'activate先前就已行的程式
End
End If
End Sub