Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Why does Excel ask me to save changes?
Hi
I have a little workbook with two sheets. On the sheet in the front (named Start) I have placed a ListBox (named lstTemplates, ListFillRange:Tabel!A:A) and a CommandBottom (named cmdSelect) and a CommandBottom (named cmdCancel). On the sheet in the background (named Table) I have the data used to fill in the listbox and the macros below. If I open the workbook and immediately clicks on cmdCancel, the Excel asks me if I want to save changes. To avoid this question I have to uncomment the "ActiveWorkbook.Save". Why is it necessary to save? I haven't changed anything! Is there a way to avoid the "'ActiveWorkbook.Save" before the "Application.Quit"? I have tried with a "ActiveWorkbook.Close SaveChanges = False", but the "Application.Quit" didn't execute. The .xls file will be placed in a writeprotected area, therefor the "ActiveWorkbook.Save" will be a bad idear to use. Macroes related to sheet "Start" ------------------------------------ begin Private Sub cmdCancel_Click() If Workbooks.Count 1 Then ActiveWorkbook.Close SaveChanges = False Else 'ActiveWorkbook.Save Application.Quit End If End Sub Private Sub cmdSelect_Click() OpenTemplate End Sub Private Sub lstTemplates_DblClick(ByVal Cancel As MSForms.ReturnBoolean) OpenTemplate End Sub Private Sub OpenTemplate() Dim WorkbookName As String Dim i As Integer If lstTemplates.ListIndex 0 And lstTemplates.Value < "" Then WorkbookName = Worksheets("Table").Range("B" & (lstTemplates.ListIndex + 1)) & _ "\" & Worksheets("Table").Range("C" & (lstTemplates.ListIndex + 1)) Workbooks.Open (WorkbookName) Else MsgBox ("No template is selected") End If End Sub Macroes related to sheet "Start" ------------------------------------ end Kind regards - Ebbe |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Why does Excel ask me to save changes?
Although something else may be going on here, this article explains some
possible causes. http://support.microsoft.com/kb/274500/en-us -- Jim "Ebbe" wrote in message ... Hi I have a little workbook with two sheets. On the sheet in the front (named Start) I have placed a ListBox (named lstTemplates, ListFillRange:Tabel!A:A) and a CommandBottom (named cmdSelect) and a CommandBottom (named cmdCancel). On the sheet in the background (named Table) I have the data used to fill in the listbox and the macros below. If I open the workbook and immediately clicks on cmdCancel, the Excel asks me if I want to save changes. To avoid this question I have to uncomment the "ActiveWorkbook.Save". Why is it necessary to save? I haven't changed anything! Is there a way to avoid the "'ActiveWorkbook.Save" before the "Application.Quit"? I have tried with a "ActiveWorkbook.Close SaveChanges = False", but the "Application.Quit" didn't execute. The .xls file will be placed in a writeprotected area, therefor the "ActiveWorkbook.Save" will be a bad idear to use. Macroes related to sheet "Start" ------------------------------------ begin Private Sub cmdCancel_Click() If Workbooks.Count 1 Then ActiveWorkbook.Close SaveChanges = False Else 'ActiveWorkbook.Save Application.Quit End If End Sub Private Sub cmdSelect_Click() OpenTemplate End Sub Private Sub lstTemplates_DblClick(ByVal Cancel As MSForms.ReturnBoolean) OpenTemplate End Sub Private Sub OpenTemplate() Dim WorkbookName As String Dim i As Integer If lstTemplates.ListIndex 0 And lstTemplates.Value < "" Then WorkbookName = Worksheets("Table").Range("B" & (lstTemplates.ListIndex + 1)) & _ "\" & Worksheets("Table").Range("C" & (lstTemplates.ListIndex + 1)) Workbooks.Open (WorkbookName) Else MsgBox ("No template is selected") End If End Sub Macroes related to sheet "Start" ------------------------------------ end Kind regards - Ebbe |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Why does Excel ask me to save changes?
Hi Jim
After reading Your link, I have discovered that the reason to the prompt is the information in the property "ListFillRange=Tabel!A:A" in the ListBox "lstTemplates". Leaving the proporty blank causes workbook to close propperly without a prompt. The filling in the listbox will course Excel to belive that the workbook is changed. Can I in any way persuade Excel that it does not have to prompt, when changes is made in exatly this workbook? Ebbe "Jim Rech" skrev i en meddelelse ... Although something else may be going on here, this article explains some possible causes. http://support.microsoft.com/kb/274500/en-us -- Jim "Ebbe" wrote in message ... Hi I have a little workbook with two sheets. On the sheet in the front (named Start) I have placed a ListBox (named lstTemplates, ListFillRange:Tabel!A:A) and a CommandBottom (named cmdSelect) and a CommandBottom (named cmdCancel). On the sheet in the background (named Table) I have the data used to fill in the listbox and the macros below. If I open the workbook and immediately clicks on cmdCancel, the Excel asks me if I want to save changes. To avoid this question I have to uncomment the "ActiveWorkbook.Save". Why is it necessary to save? I haven't changed anything! Is there a way to avoid the "'ActiveWorkbook.Save" before the "Application.Quit"? I have tried with a "ActiveWorkbook.Close SaveChanges = False", but the "Application.Quit" didn't execute. The .xls file will be placed in a writeprotected area, therefor the "ActiveWorkbook.Save" will be a bad idear to use. Macroes related to sheet "Start" ------------------------------------ begin Private Sub cmdCancel_Click() If Workbooks.Count 1 Then ActiveWorkbook.Close SaveChanges = False Else 'ActiveWorkbook.Save Application.Quit End If End Sub Private Sub cmdSelect_Click() OpenTemplate End Sub Private Sub lstTemplates_DblClick(ByVal Cancel As MSForms.ReturnBoolean) OpenTemplate End Sub Private Sub OpenTemplate() Dim WorkbookName As String Dim i As Integer If lstTemplates.ListIndex 0 And lstTemplates.Value < "" Then WorkbookName = Worksheets("Table").Range("B" & (lstTemplates.ListIndex + 1)) & _ "\" & Worksheets("Table").Range("C" & (lstTemplates.ListIndex + 1)) Workbooks.Open (WorkbookName) Else MsgBox ("No template is selected") End If End Sub Macroes related to sheet "Start" ------------------------------------ end Kind regards - Ebbe |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Why does Excel ask me to save changes?
Can I in any way persuade Excel that it does not have to prompt
This should do it: ActiveWorkbook.Saved = True -- Jim |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Why does Excel ask me to save changes?
Hi Jim
It does not work :-( I am making a work-around by saving the workbook in a temporary directory and deleting it afterwards. BUT it would be better if a more "correct" solution is found. Ebbe "Jim Rech" skrev i en meddelelse ... Can I in any way persuade Excel that it does not have to prompt This should do it: ActiveWorkbook.Saved = True -- Jim |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Why does Excel ask me to save changes?
It worked for me. Thanks, this is just what I needed.
"Jim Rech" wrote: Can I in any way persuade Excel that it does not have to prompt This should do it: ActiveWorkbook.Saved = True -- Jim |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Save, save as, page setup dimmed out in unprotected excel sheet? | Excel Discussion (Misc queries) | |||
'document not saved' for 'save' or 'save as' an EXCEL file | Excel Discussion (Misc queries) | |||
Save & Save As features in file menu of Excel | Excel Discussion (Misc queries) | |||
Save Excel file - prompts to save - no Volitile functions used | Excel Worksheet Functions | |||
save button in excel to save one of the worksheets with a cell value as its name | Excel Programming |