View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
shirley shirley is offline
external usenet poster
 
Posts: 1
Default How to promt users to save their work?

For my program, all new entries are in red. When the user clicks th
close button of the workbook, i want to do a msgbox to prompt users t
save. when they save, the font becomes black. this way, when they ope
the workbook again, they cannot make changes to the entries. attache
is the coding. I dont think my code is working because when the clos
button is pressed, its the default excel msgbox.

Sub ActiveWorkbook_beforeClose()
Dim Msg, Style, Title, Response

Msg = "Are you sure you want to exit? No changes are allowed afte
closing of the workbook."

Style = vbYesNo + vbQuestion
Title = "Important!"

Response = MsgBox(Msg, Style, Title)

If Response = vbYes Then
ActiveWorkbook.Save


Else: End If .
End Su

--
Message posted from http://www.ExcelForum.com