Public Sub TerminateProgram()
On Error Resume Next
Static Unloading As Boolean
Dim idx As Integer
If Unloading Then Exit Sub
Unloading = True
For idx = Forms.Count - 1 To 0 Step -1
Unload Forms(idx)
Set Forms(idx) = Nothing
Next idx
Unloading = False
End Sub