From: Bob on
After I Save a workbook, I then Close it. But when I do so, Excel prompts me
to Save the workbook again.

Is there some code I can add to the Workbook_BeforeClose event that will
negate the prompt to re-save it (even after I just Saved it!)?

Thanks in advance for any help.

Bob

From: Bob on
Forgive me, I should have said, "Is there some code I can add to the
Workbook_BeforeClose event that will auto-save the workbook when I Close it?"


"Bob" wrote:

> After I Save a workbook, I then Close it. But when I do so, Excel prompts me
> to Save the workbook again.
>
> Is there some code I can add to the Workbook_BeforeClose event that will
> negate the prompt to re-save it (even after I just Saved it!)?
>
> Thanks in advance for any help.
>
> Bob
>
From: FSt1 on
hi
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'some code here
ActiveWorkbook.Close True '**************
End Sub

when you run code on the before close event, that triggers excel into
thinking something as changed therefore you need to save the book. again.
so you will have to resave the workbook . the above does that automaticly.
no extra clicking on extra popups.
regards
FSt1

"Bob" wrote:

> Forgive me, I should have said, "Is there some code I can add to the
> Workbook_BeforeClose event that will auto-save the workbook when I Close it?"
>
>
> "Bob" wrote:
>
> > After I Save a workbook, I then Close it. But when I do so, Excel prompts me
> > to Save the workbook again.
> >
> > Is there some code I can add to the Workbook_BeforeClose event that will
> > negate the prompt to re-save it (even after I just Saved it!)?
> >
> > Thanks in advance for any help.
> >
> > Bob
> >
From: Dave Peterson on
Sometimes, the workbook isn't active when it's being closed.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'some code here
me.Close True '**************
End Sub

========
But as a user, I wouldn't want the developer to decide for me whether the
workbook should be saved when it's closed. And I wouldn't want the developer to
discard my changes, either.

I've never understood how developers keep breathing when users have this kind of
thing forced on them <vbg>.

FSt1 wrote:
>
> hi
> Private Sub Workbook_BeforeClose(Cancel As Boolean)
> 'some code here
> ActiveWorkbook.Close True '**************
> End Sub
>
> when you run code on the before close event, that triggers excel into
> thinking something as changed therefore you need to save the book. again.
> so you will have to resave the workbook . the above does that automaticly.
> no extra clicking on extra popups.
> regards
> FSt1
>
> "Bob" wrote:
>
> > Forgive me, I should have said, "Is there some code I can add to the
> > Workbook_BeforeClose event that will auto-save the workbook when I Close it?"
> >
> >
> > "Bob" wrote:
> >
> > > After I Save a workbook, I then Close it. But when I do so, Excel prompts me
> > > to Save the workbook again.
> > >
> > > Is there some code I can add to the Workbook_BeforeClose event that will
> > > negate the prompt to re-save it (even after I just Saved it!)?
> > >
> > > Thanks in advance for any help.
> > >
> > > Bob
> > >

--

Dave Peterson
From: Bob on
Thanks for your help! I really appreciate it.

BTW, if I can impose on you one more time, can you tell me the difference
between using ActiveWorkbook.Close True versus using ThisWorkbook.Save?

Thanks again.

Regards,
Bob


"FSt1" wrote:

> hi
> Private Sub Workbook_BeforeClose(Cancel As Boolean)
> 'some code here
> ActiveWorkbook.Close True '**************
> End Sub
>
> when you run code on the before close event, that triggers excel into
> thinking something as changed therefore you need to save the book. again.
> so you will have to resave the workbook . the above does that automaticly.
> no extra clicking on extra popups.
> regards
> FSt1
>
> "Bob" wrote:
>
> > Forgive me, I should have said, "Is there some code I can add to the
> > Workbook_BeforeClose event that will auto-save the workbook when I Close it?"
> >
> >
> > "Bob" wrote:
> >
> > > After I Save a workbook, I then Close it. But when I do so, Excel prompts me
> > > to Save the workbook again.
> > >
> > > Is there some code I can add to the Workbook_BeforeClose event that will
> > > negate the prompt to re-save it (even after I just Saved it!)?
> > >
> > > Thanks in advance for any help.
> > >
> > > Bob
> > >