View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ben McClave Ben McClave is offline
external usenet poster
 
Posts: 173
Default Save and closed excel workbook from the sheet

Hi Bakar,

This code should work:


Sub SaveAndClose()

If MsgBox("Would you like to save this workbook and close it?", vbYesNoCancel, "Save and Close?") < vbYes _
Then Exit Sub

With ActiveWorkbook
If .Path = "" Then
.SaveAs
Else
.Save
.Close
End If
End With

End Sub