View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Need some help with Exit Event

Matt,

Try something like

Private Sub btnExit_Click()

Dim FName As Variant
FName = Application.GetSaveAsFilename(, "Excel Files
(*.xls),*.xls")
If FName = False Then
Exit Sub
End If
ThisWorkbook.SaveAs Filename:=FName
Me.Hide
Application.Quit
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Matt" wrote in message
oups.com...
Hi All- I've got an exit button in a user form that I want to
accomplish the following with when clicked-
1. Prompt the user to see if they want to save the form and
associated
workbook.
2. If yes to save then ask to save as and where.
3. Exit form and excel.

Presently I have the following code associated with the button.
Obviously it's inoperable at this point. I've searched quite a
bit to
find some similiar code, without much luck. Any help would be
greatly
appreciated. Thanks.

Private Sub BtnExit_Click()
End Sub