Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
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 |