View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
pgarcia pgarcia is offline
external usenet poster
 
Posts: 304
Default "Call" Commandbutton1()

Thanks again, but for some reson it did not like that code. I get a "Complie
error."

"JLGWhiz" wrote:

Change it to OK only.

Sub clsSavWB()
Resp = MsgBox("Click OK to Save", , "Close Workbook"
If Resp = vbOK Then
ActiveWorkbook.Close SaveChanges:=False
End If
End Sub


"pgarcia" wrote:

Thanks, but I don't want to give my user a yes/no question. Just an OK and
when they click on it, it close the application.

"JLGWhiz" wrote:

Put this in the standard code module and you can either make a keyboard
shortcut or add a button to the tool bar and assign this code to it.

Sub clsSavWB()
Resp = MsgBox("Do you want to close without _
saving?", vbYes/No + vbQuestion, "Close Workbook"
If Resp = vbYes Then
ActiveWorkbook.Close SaveChanges:=False
End If
End Sub

"pgarcia" wrote:

When I'm trying to do is, bring up a "msgbox" but when you click on "OK" it
closes the Excel without saveing the work sheet. I belive this will be done
as a userform, but not sure on the VB codes.

Thanks