Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Closing excel and saving workbooks

Hi,

I opened a new session of excel and kept the personal macro file unhidden.
Then I opened a new worksheet book1.

In VB I inserted a module in Book 1.

Then I wrote this code.

Surprsingly, excel saved book 1 in my Xlstart folder along with the personal
macro workbook. ( I had not saved Book 1)

Sub closingexcel()
Application.DisplayAlerts = False
Application.Quit
Workbooks("book1").Save
Workbooks("personal").Save
End Sub

Regards,
Hari
India


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Closing excel and saving workbooks

Hi
you should try to first save the files and the quit the application.
Also Excel saves the file in the current directory. So you may change
the directory first in your macro
--
Regards
Frank Kabel
Frankfurt, Germany


Hari wrote:
Hi,

I opened a new session of excel and kept the personal macro file
unhidden. Then I opened a new worksheet book1.

In VB I inserted a module in Book 1.

Then I wrote this code.

Surprsingly, excel saved book 1 in my Xlstart folder along with the
personal macro workbook. ( I had not saved Book 1)

Sub closingexcel()
Application.DisplayAlerts = False
Application.Quit
Workbooks("book1").Save
Workbooks("personal").Save
End Sub

Regards,
Hari
India


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Closing excel and saving workbooks

Hi Frank,

I was doing a test to understand whether excel saves the files if I write
application.quit before writing the save workbooks statements.

I was surprised that excel continues to exceute statement even after it
encounters quit statement. ( That is it saved my Book 1). I still dont
understand this aspect completely.

Also, I was surprised that Excel saved my book1 which was a new workbook and
usually if we press on save button on new workbooks it prompts for the
location ( and the default location is My Documents for my excel 2002) so I
expected excel to save the file in My documents if at all the file is saved.
Rather excel saved it in xlstart folder. U say that I shud change the
directory. But, how is it that when Im working on a completely new excel
session with no other macros run in it the VB remembers or considers the
default location to be xlstart folder.

Please elaborate if possible.

Regards,
Hari
India


"Frank Kabel" wrote in message
...
Hi
you should try to first save the files and the quit the application.
Also Excel saves the file in the current directory. So you may change
the directory first in your macro
--
Regards
Frank Kabel
Frankfurt, Germany


Hari wrote:
Hi,

I opened a new session of excel and kept the personal macro file
unhidden. Then I opened a new worksheet book1.

In VB I inserted a module in Book 1.

Then I wrote this code.

Surprsingly, excel saved book 1 in my Xlstart folder along with the
personal macro workbook. ( I had not saved Book 1)

Sub closingexcel()
Application.DisplayAlerts = False
Application.Quit
Workbooks("book1").Save
Workbooks("personal").Save
End Sub

Regards,
Hari
India




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
Closing workbooks w/o closing Excel Barb in MD Excel Discussion (Misc queries) 3 February 15th 10 06:42 PM
Saving and Closing erf Excel Discussion (Misc queries) 1 June 18th 08 08:38 AM
Saving when closing excel welshmag Excel Discussion (Misc queries) 1 October 4th 07 12:26 PM
close workbooks without closing excel ? Clute Excel Discussion (Misc queries) 2 August 5th 06 09:50 PM
Closing Excel without saving Abs Excel Discussion (Misc queries) 9 December 7th 05 03:10 PM


All times are GMT +1. The time now is 10:14 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"