![]() |
Closing Excel - no save prompt
Hi
I'm automating Excel from VB, populating a sheet and then showing the user. The user may or may not make chnages to this sheet. When the user closes Excel, the user is not prompted to save changes, but rather Excel closes down without asking. Is there a flag or something I can set to force Excel to prompt for save changes if any changes have occurred to this sheet. Thanks Simon |
Closing Excel - no save prompt
Excel should prompt to save. To test that I ran this script (copy and save
as a VBS file): Dim XL Set XL = CreateObject("Excel.Application") XL.Workbooks.Add XL.Activesheet.Range("A1").Value = "x" XL.Visible = True Quiting Excel without doing a thing I got a save prompt. -- Jim "Simon Woods" wrote in message ... | Hi | | I'm automating Excel from VB, populating a sheet and then showing the user. | The user may or may not make chnages to this sheet. When the user closes | Excel, the user is not prompted to save changes, but rather Excel closes | down without asking. Is there a flag or something I can set to force Excel | to prompt for save changes if any changes have occurred to this sheet. | | Thanks | | Simon | | |
Closing Excel - no save prompt
Simon Woods wrote: Hi I'm automating Excel from VB, populating a sheet and then showing the user. The user may or may not make chnages to this sheet. When the user closes Excel, the user is not prompted to save changes, but rather Excel closes down without asking. Is there a flag or something I can set to force Excel to prompt for save changes if any changes have occurred to this sheet. Thanks Simon Hi Simon, My guess is that either your code (or maybe some other code in the workbook you are opening) is setting Excel's display alerts property equal to false. To test this, maybe include the fragment "msgbox ExcelApp.DisplayAlerts" (if your application variable is ExcelApp) in your script and see if it gives False. If so, including ExcelApp.DisplayAlerts = True should fix the problem. Hope that helps, -John Coleman |
Closing Excel - no save prompt
"John Coleman" wrote in message ups.com... Simon Woods wrote: Hi I'm automating Excel from VB, populating a sheet and then showing the user. The user may or may not make chnages to this sheet. When the user closes Excel, the user is not prompted to save changes, but rather Excel closes down without asking. Is there a flag or something I can set to force Excel to prompt for save changes if any changes have occurred to this sheet. Thanks Simon Hi Simon, My guess is that either your code (or maybe some other code in the workbook you are opening) is setting Excel's display alerts property equal to false. To test this, maybe include the fragment "msgbox ExcelApp.DisplayAlerts" (if your application variable is ExcelApp) in your script and see if it gives False. If so, including ExcelApp.DisplayAlerts = True should fix the problem. Yep - you're right. I stopped alerts when populating the sheet and forgot to switch it back on Thanks Simon |
All times are GMT +1. The time now is 03:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com