Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 22
Send a message via Skype™ to Bakar
Unhappy Save and closed excel workbook from the sheet

Hi Masters
I want to have a command button which is located on my excel sheet
so that i click on it it save my document and close the workbook also

Plz help

Balkar
  #2   Report Post  
Posted to microsoft.public.excel.programming
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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save data to closed workbook Do Excel Programming 2 November 17th 10 07:19 PM
save worksheet data to alternate closed workbook - next row J.W. Aldridge Excel Programming 1 October 16th 10 12:58 AM
Copy sheet from closed workbook [email protected] Excel Programming 2 October 2nd 09 06:22 AM
ADO - recordset - closed excel workbook - know sheet name and cell name but no named ranges defined grahamd Excel Programming 1 October 18th 04 06:13 PM
Save TextBox Entry after WorkBook is closed wpllc2004 Excel Programming 1 April 12th 04 12:30 PM


All times are GMT +1. The time now is 05:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"