Cmdbutton to Quit excel/userform/vba?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vbanewbie2
    New Member
    • Jul 2010
    • 35

    #1

    Cmdbutton to Quit excel/userform/vba?

    I want to create a Command button that will allow the user to save their work and totally close out of excel and their user form. Any ideas on the code for this.
  • Guido Geurs
    Recognized Expert Contributor
    • Oct 2009
    • 767

    #2
    Close the workbook =

    Code:
    Workbooks("BOOK1.XLS").Close SaveChanges:=True
    If You also want to exit Excel:

    Code:
    Private Sub CommandButton1_Click()
    Dim w As Workbook
       For Each w In Application.Workbooks
           w.Save
       Next w
       Application.Quit
    End Sub

    Comment

    • Aiden Triffitt
      New Member
      • Jul 2010
      • 3

      #3
      for vb 6

      end

      for C++ and 4 or 5

      me.end
      or me.close

      Comment

      Working...