troubles with ActiveWorkbook.Save

G

Gabriele C

HI!
i'm having troubles with activeworkbook.save
I have a button that calls "closewb"macro
If I use this button,the file is closed WITHOUT saving anything
If I close by rightclick-close,or with the x in the topright corner, i
saves.Why?
I will be happy If anyone helps :)



Sub closewb()
ActiveWorkbook.Close
End Sub


Private Sub Workbook_BeforeClose(Cancel As Boolean)

Worksheets(1).Select
If Range("c2").Value = "EFFETTIVO" Or Range("f50").Value = "annulla
Then
ActiveWorkbook.Saved = True
Else: ActiveWorkbook.Save
End If

End Su
 
G

Gabriele C

Here I am...

I missed ":" while writing savechanges : = true

Now everything goes well...

It's strange ,bytheway....I didn't receive any kind of error...
thought that the beforeclose sub was less flexible...mmh,don't kno
what to think!

Bye
 
Top