Results 1 to 11 of 11

Thread: Stop pop-up when excel closes

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    VBAX Mentor CBrine's Avatar
    Joined
    Jun 2004
    Location
    Toronto, Canada
    Posts
    389
    Location
    Daxton,
    I did something close to yours. I set the saved flag to true, then excel will not prompt you to save and the application.quit will bypass the save. So if you want to not save the activeworkbook, you might want to try this. It will save each open workbook, except for the workbook that the code is executed on, prior to closing excel.


    Private Sub CommandButton1_Click()
    Dim wb As Workbook, wb2 As Workbook
    Set wb = ActiveWorkbook
    For Each wb2 In Application.Workbooks
        If wb2.Name = wb.Name Then
            wb2.Saved = True
        Else
            wb2.Save
        End If
    Next
    Application.Quit
    End Sub
    Last edited by Aussiebear; 04-29-2023 at 10:27 PM. Reason: Adjusted the code tags
    The most difficult errors to resolve are the one's you know you didn't make.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •