LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default "Save" macro problem, still prompted to save when closing work

Oh, for heaven's sake! <lol It's one little line of code right after the
save that I never think about. I have a tendency to just copy/paste that
into every macro ina workbook of this type that I just never think of it.
It's the protect code to re-protect the sheet. But I think in the case of
this one macro, I can get rid of that as on thinking it through, it's not
necessary to have.


The original code:
Sub SaveWorksheet()
ActiveSheet.Unprotect 'place at the beginning of the code
ThisWorkbook.Save
ActiveSheet.Protect ' place at end of code
End Sub

Now I just have the one line:
Sub SaveWorksheet()
ThisWorkbook.Save
End Sub

Thanks. You guys have so much patience. To think that something so simple
was tripping me up. <g

Cheers. :oD

"Jim Thomlinson" wrote in message
...
Do you have any event code that might be firing after the save? If so that
code could be modifying the book and then you will be prompted to save the
changes. something is modifying the book after the save...
--
HTH...

Jim Thomlinson


"StargateFanFromWork" wrote:

But the macro doesn't go on to do anything else. I only have that one

line
of code to save the workbook in that macro and that's it. That file is

the
only one that was open when I pressed the save button on my commandbar

and
then I've gone on to close right away only to get the prompt. But I

just
saved the file! <g It's weird as I guess I don't know what Excel is

doing
in the background that is different in each case since the two actions
supposedly should accomplish the same thing.

I don't understand re the code below. I'm not sure it would resolve

this
issue, would it? I just need to save the workbook properly so that when

I
then go to close the file, I don't get a prompt. This is just so weird.
I'd just like to get to the bottom of this and get this to work, but if
worse comes to worst, I'll just remove the bottom. But now I would like

to
understand before going that route.

Tx. :oD

"Jim Thomlinson" wrote in

message
...
Here is a little background into saving. Excel uses a flag to indicate
whether the file needs to be saved or not. When you Save the workbook

it
sets
the flag to true indicating that a save is not necessary.

Thisworkbook.Save
will set that flag to true. If your macro then goes on to do anything

to
the
wrokbook then the flag will be set back to false and you will be

prompted
to
save the workbook. If you want to you can manually set the flag using:

ThisWorkbook.Saved = True 'No save required
or
ThisWorkbook.Saved = False 'Prompted to save

--
HTH...

Jim Thomlinson


"StargateFanFromWork" wrote:

I got this code from the archives to save the workbook:

ThisWorkbook.Save

When I'd recorded saving the workbook earlier, the code was very

similar,
ActiveWorkbook.Save.

The difficulty is that after using either macro, yes, I do see the

saving
message at the bottom of the workbook that alerts me to the saving

process
but when I immediately go to close the workbook, I'm still prompted

to
save
it. Yet when I click on FILE SAVE, I close the workbook and the

prompt
doesn't come up.

Is there better code to use rather than either workbook.save that

will
really save the file?

TIA.








 
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 file before closing" mkilbour Excel Discussion (Misc queries) 2 June 1st 10 08:05 PM
Protect "Copy" and "Save As" changes to workbook Jason W Excel Discussion (Misc queries) 3 January 4th 09 01:13 AM
"Save" and "Save As" options greyed out - "Save as Webpage" option Bill Excel Discussion (Misc queries) 0 January 16th 07 04:47 PM
excel 02 always asks "save changes?" when closing unaltered file 6foot6 Excel Discussion (Misc queries) 1 February 16th 06 07:41 PM
save and restore "Workbook Menu Bar" & "Cell" menus Jeff Higgins Excel Programming 2 February 14th 05 01:33 AM


All times are GMT +1. The time now is 07:29 PM.

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

About Us

"It's about Microsoft Excel"