View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default "Save" macro problem, still prompted to save when closing work

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.