ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   suppressing "do you want to save changes..." (https://www.excelbanter.com/excel-programming/375052-suppressing-do-you-want-save-changes.html)

Ken

suppressing "do you want to save changes..."
 
I recentely started to get prompted "Do you want to save the changes to
*.xls?" regardless of whether or not I made any changes. I have many
users who now receive the prompt for files that they did not even know
they had opened. Those are hidden files that contain code and data
that are opened via an add-in that I wrote and people have used for
years without even being aware the hidden files even existed. I believe
this just started happening with a server upgrade (to 2003). Does
anyone know of a setting somewhere that could be set to always prompt
for saving changes, even when no changes were made? Or, alternatively,
is there something I could put in the code to suppress that warning on
certain files?

Thanks

Ken


Jim Rech

suppressing "do you want to save changes..."
 
If you know, absolutely, that you never want a user to be prompted to "save
changes" add this code to the ThisWorkbook module of the workbook:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Saved = True
End Sub

--
Jim
"Ken" wrote in message
oups.com...
I recentely started to get prompted "Do you want to save the changes to
*.xls?" regardless of whether or not I made any changes. I have many
users who now receive the prompt for files that they did not even know
they had opened. Those are hidden files that contain code and data
that are opened via an add-in that I wrote and people have used for
years without even being aware the hidden files even existed. I believe
this just started happening with a server upgrade (to 2003). Does
anyone know of a setting somewhere that could be set to always prompt
for saving changes, even when no changes were made? Or, alternatively,
is there something I could put in the code to suppress that warning on
certain files?

Thanks

Ken




Incidental

suppressing "do you want to save changes..."
 
Hi

You could try either

Application.DisplayAlerts = False
ActiveWorkbook.Saved = True

in your workbookclose event

s

Ken wrote:
I recentely started to get prompted "Do you want to save the changes to
*.xls?" regardless of whether or not I made any changes. I have many
users who now receive the prompt for files that they did not even know
they had opened. Those are hidden files that contain code and data
that are opened via an add-in that I wrote and people have used for
years without even being aware the hidden files even existed. I believe
this just started happening with a server upgrade (to 2003). Does
anyone know of a setting somewhere that could be set to always prompt
for saving changes, even when no changes were made? Or, alternatively,
is there something I could put in the code to suppress that warning on
certain files?

Thanks

Ken



Ken

suppressing "do you want to save changes..."
 
Thanks Jim and s

saved=true in the before close event takes care of most of my problem.
It took me a little while to get a hidden file saved with that code in
it, but, I was eventually able to save my "addin data" file through
code in another workbook while "addin data" data was hidden.

I wish I knew why this started happening. All Excel files on one
particular server trigger the "save changes" prompt, regardless of
whether or not there have been changes.

Thanks

again.

Ken



Jim Rech wrote:
If you know, absolutely, that you never want a user to be prompted to "save
changes" add this code to the ThisWorkbook module of the workbook:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Saved = True
End Sub

--
Jim
"Ken" wrote in message
oups.com...
I recentely started to get prompted "Do you want to save the changes to
*.xls?" regardless of whether or not I made any changes. I have many
users who now receive the prompt for files that they did not even know
they had opened. Those are hidden files that contain code and data
that are opened via an add-in that I wrote and people have used for
years without even being aware the hidden files even existed. I believe
this just started happening with a server upgrade (to 2003). Does
anyone know of a setting somewhere that could be set to always prompt
for saving changes, even when no changes were made? Or, alternatively,
is there something I could put in the code to suppress that warning on
certain files?

Thanks

Ken



Jim Rech

suppressing "do you want to save changes..."
 
I was eventually able to save my "addin data" file through code in another
workbook while "addin data" data was hidden.


I find the easiest way to save a workbook that is hidden is in the VBE.
Select the workbook in the VBE's Project Explorer and then click the Save
button on the VBE Standard toolbar.

I wish I knew why this started happening


You didn't add any volatile functions like NOW or OFFSET or INDIRECT, did
you? They are always automatically calced when a workbook that has them is
opened. So Excel thinks changes have been made.

--
Jim
"Ken" wrote in message
oups.com...
Thanks Jim and s

saved=true in the before close event takes care of most of my problem.
It took me a little while to get a hidden file saved with that code in
it, but, I was eventually able to save my "addin data" file through
code in another workbook while "addin data" data was hidden.

I wish I knew why this started happening. All Excel files on one
particular server trigger the "save changes" prompt, regardless of
whether or not there have been changes.

Thanks

again.

Ken



Jim Rech wrote:
If you know, absolutely, that you never want a user to be prompted to
"save
changes" add this code to the ThisWorkbook module of the workbook:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Saved = True
End Sub

--
Jim
"Ken" wrote in message
oups.com...
I recentely started to get prompted "Do you want to save the changes to
*.xls?" regardless of whether or not I made any changes. I have many
users who now receive the prompt for files that they did not even know
they had opened. Those are hidden files that contain code and data
that are opened via an add-in that I wrote and people have used for
years without even being aware the hidden files even existed. I believe
this just started happening with a server upgrade (to 2003). Does
anyone know of a setting somewhere that could be set to always prompt
for saving changes, even when no changes were made? Or, alternatively,
is there something I could put in the code to suppress that warning on
certain files?

Thanks

Ken





Ken

suppressing "do you want to save changes..."
 
Jim
Saving in VBE is good to know. Thanks again.
There has definitely not been a change to my addin data file, as it has
been opening, not visible, and closing without people knowing about it
for years. That is the file that has triggered all the calls since
users are prompted to save something they don't know they have open.
It happens on every file on one particular server and not on the
others, and it just started in the last week. Thre must be a setting
somewhere that says to bother people about saving files that don't need
to be saved.
Thanks
Ken


Jim Rech wrote:
I was eventually able to save my "addin data" file through code in another
workbook while "addin data" data was hidden.


I find the easiest way to save a workbook that is hidden is in the VBE.
Select the workbook in the VBE's Project Explorer and then click the Save
button on the VBE Standard toolbar.

I wish I knew why this started happening


You didn't add any volatile functions like NOW or OFFSET or INDIRECT, did
you? They are always automatically calced when a workbook that has them is
opened. So Excel thinks changes have been made.

--
Jim
"Ken" wrote in message
oups.com...
Thanks Jim and s

saved=true in the before close event takes care of most of my problem.
It took me a little while to get a hidden file saved with that code in
it, but, I was eventually able to save my "addin data" file through
code in another workbook while "addin data" data was hidden.

I wish I knew why this started happening. All Excel files on one
particular server trigger the "save changes" prompt, regardless of
whether or not there have been changes.

Thanks

again.

Ken



Jim Rech wrote:
If you know, absolutely, that you never want a user to be prompted to
"save
changes" add this code to the ThisWorkbook module of the workbook:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Saved = True
End Sub

--
Jim
"Ken" wrote in message
oups.com...
I recentely started to get prompted "Do you want to save the changes to
*.xls?" regardless of whether or not I made any changes. I have many
users who now receive the prompt for files that they did not even know
they had opened. Those are hidden files that contain code and data
that are opened via an add-in that I wrote and people have used for
years without even being aware the hidden files even existed. I believe
this just started happening with a server upgrade (to 2003). Does
anyone know of a setting somewhere that could be set to always prompt
for saving changes, even when no changes were made? Or, alternatively,
is there something I could put in the code to suppress that warning on
certain files?

Thanks

Ken





All times are GMT +1. The time now is 01:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com