Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
Save, save as, page setup dimmed out in unprotected excel sheet? ccKeithJ Excel Discussion (Misc queries) 3 December 14th 07 07:07 PM
'document not saved' for 'save' or 'save as' an EXCEL file Judy Chuang Excel Discussion (Misc queries) 1 July 11th 05 10:12 PM
Save & Save As features in file menu of Excel Blue Excel Discussion (Misc queries) 9 December 27th 04 08:49 PM
Save Excel file - prompts to save - no Volitile functions used POWER CERTS Excel Worksheet Functions 2 November 1st 04 09:27 PM
save button in excel to save one of the worksheets with a cell value as its name Colin[_9_] Excel Programming 2 September 21st 04 11:28 PM


All times are GMT +1. The time now is 02:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"