Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
xl.displayalerts = False
wbk.save
wbk.Close
Set xl = Nothing
End Sub
You'll find this more efficient...
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
xl.wbk.Close False '//no changes so don't save
xl.Quit: Set wbk = Nothing: Set xl = Nothing
End Sub
...because it cleans up VB6 properly AND doesn't leave Excel running with
DisplayAlerts turned off! (Closing a workbook and specifying the SaveChanges
arg effectively cancels the "Do you want to save..." alert!)
--
Garry
Free usenet access at
http://www.eternal-september.org
Classic
VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.
vb.general.discussion