Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel, Automatic saving when end program,,

Status
Not open for further replies.

Nitha120

Technical User
Feb 22, 2005
33
US
Hello guys,
I am making chart for each of my worksheet in a workbook. roughly 30 worksheets in each work book...
Is there a codes that I can insert in my macro that would:

1. save the change automatically when it finish graphing each worksheet so when the program terminate with (CTRL+ALT+DELETE, End Program) It is able to save some of the data rather then not at all.

2. automatically save whatever it have up to the point before the program is terminated (End program).

Any suggestion is very much needed!
 
Take a look at the Workbook.Save method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
It can save anywhere - as long as you enter a save command at that point in the macro....

Rgds, Geoff

"Three things are certain: Death, taxes and lost data. Guess which has occurred"

Please read FAQ222-2244 before you ask a question
 
Hi im not fimilar wth the save command or workbook,save method could you show me or tell me where to find more information on it?
thanks
 
Have you tried the macrorecorder ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
All right quys, enough with the irony.

Nitha, in future cases, try to find information in other locations than these foras, since what your asking for is very basic. You'll probably find it in the FAQs or by using SEARCH as well.

However, I believe all questions asked politely deserves an aswer.


You can simply enter

Code:
activeworkbook.save

anywhere in the code, for the workbook to save.

For this to happen automatically upon closing the workbook, then you need to set a workbook_beforeclose event. Doubleclick the "This workbook" - folder in the top-left corner of the VB editor. Paste the folling code:

Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)

ActiveWorkbook.Save

End Sub

Please look trough the HELP in the VB editor (F1) on understanding events as well as the SAVE method, and you'll come a long way.

Cheers

// Patrik
______________________________

To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the IT Professional, the glass is twice as big as it needs to be.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top