Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

BeforeSave Function

Status
Not open for further replies.

MrBrooks1515

Computer
Joined
Jan 7, 2003
Messages
2
Location
US
I'm using the BeforeSave function and usng the code that is in the Microsoft Excel VB help section under BeforeSave. When you click save, a box is supposed to pop up asking if you really want to save. If you click "no" then it isn't supposed to save. Only when I click no it saves anyway. Any ideas? Thanks
 
I just tried it and it works as illustrated.
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Dim a As Variant
    a = MsgBox("Do you really want to save the workbook?", vbYesNo)
    If a = vbNo Then Cancel = True
End Sub
Not sure why yours would not work properly. DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
What you have down there is exactly what I have. I even tried putting it in a blank workbook and still didn't work.
 
What version of Excel are you using? I ran this test on 97. DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top