Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Glenn Rathke \(Soft Design Consulting\)
 
Posts: n/a
Default Do not propmt to save data on exit

I'm reading/writing Excel data to SQL Server thru VBA. As such I do not
want to be prompted to save the data when closing down Excel. How can I do
this?


--
Thanks
Glenn


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Paul Mathews
 
Posts: n/a
Default Do not propmt to save data on exit

Hi Glenn, try this:

Application.DisplayAlerts = False
Workbooks("YourWorkbook.xls").Close
Application.DisplayAlerts = True

If you want to immediately close right out of Excel then replace the second
line with Application.Quit.

"Glenn Rathke (Soft Design Consulting)" wrote:

I'm reading/writing Excel data to SQL Server thru VBA. As such I do not
want to be prompted to save the data when closing down Excel. How can I do
this?


--
Thanks
Glenn



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Glenn Rathke \(Soft Design Consulting\)
 
Posts: n/a
Default Do not propmt to save data on exit

Thanks for the info but unfortunately it does not work or I am missing
something else.

If the user changes a cell in the spreadsheet, I do not want the message to
appear asking them if they want to save the file when closing the workbook.
Even with this code they user is prompted. Perhaps I implemented it
incorrectly, I placed it in the before close event.

Thanks
Glenn Rathke





"Glenn Rathke (Soft Design Consulting)"
wrote in message
...
I'm reading/writing Excel data to SQL Server thru VBA. As such I do not
want to be prompted to save the data when closing down Excel. How can I do
this?


--
Thanks
Glenn



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Glenn Rathke \(Soft Design Consulting\)
 
Posts: n/a
Default This line of code does the trick

This line of code does the trick, I put it in the BeforeClose event.

ThisWorkbook.Saved = True

It tells the workbook that the most recent copy of the data has been saved
(in actuality it has not) and that it is not dirty. Now when the close event
is fired, the data does not appear that it has been changed.

Glenn


"Glenn Rathke (Soft Design Consulting)"
wrote in message
...
Thanks for the info but unfortunately it does not work or I am missing
something else.

If the user changes a cell in the spreadsheet, I do not want the message
to appear asking them if they want to save the file when closing the
workbook. Even with this code they user is prompted. Perhaps I
implemented it incorrectly, I placed it in the before close event.

Thanks
Glenn Rathke





"Glenn Rathke (Soft Design Consulting)"
wrote in message
...
I'm reading/writing Excel data to SQL Server thru VBA. As such I do not
want to be prompted to save the data when closing down Excel. How can I
do this?


--
Thanks
Glenn





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
How to save data in CSV format when a field also contains comma? V.R. Excel Discussion (Misc queries) 0 April 10th 06 09:58 AM
Save 2 separate data imports in separate worksheets on the same ex Jay Excel Worksheet Functions 1 March 8th 06 01:31 PM
consolidation of tables in excel with text and figures samenvoegen van sheets Excel Worksheet Functions 8 March 2nd 06 03:27 PM
save prompt for user exit, but no save prompt for batch import? lpj Excel Discussion (Misc queries) 1 February 25th 06 02:08 AM
From several workbooks onto one excel worksheet steve Excel Discussion (Misc queries) 6 December 1st 05 08:03 AM


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