Closing Excel Application using VBA

前端 未结 8 1192
忘了有多久
忘了有多久 2020-11-29 04:44

I have used the following without success. The active workbook closes, indeed, but the excel window remains open.

Application.ActiveWindow.Close SaveChanges:         


        
8条回答
  •  萌比男神i
    2020-11-29 04:56

    Sub button2_click()
    '
    ' Button2_Click Macro
    '
    ' Keyboard Shortcut: Ctrl+Shift+Q
    '
        ActiveSheet.Shapes("Button 2").Select
        Selection.Characters.Text = "Logout"
        ActiveSheet.Shapes("Button 2").Select
        Selection.OnAction = "Button2_Click"
        ActiveWorkbook.Saved = True
        ActiveWorkbook.Save
        Application.Quit
    End Sub
    

提交回复
热议问题