LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default On Close macro

Hi Judith,

Here is some code

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ans
ans = MsgBox("Are you sure you want tos save this file", vbYesNo)
If ans = vbNo Then
Cancel = True
End If
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--

HTH

RP
(remove nothere from the email address if mailing direct)


"JudithJubilee" wrote in message
...
Hello there,

I have spreadsheets that are updated by various people. I
would like a macro that puts up a message box when they
save or close to ask if they are sure. If they click Yes
then continue. If No then cancels the action.

I'm a beginner in VB but willing to try it!

Judith



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run Macro when close spreadsheet davemel Excel Discussion (Misc queries) 1 July 31st 06 02:03 PM
macro to close excel Pam C Excel Discussion (Misc queries) 1 May 5th 05 04:43 PM
How to close a workbook which contains the macro that's just been run? dead_girl[_2_] Excel Programming 0 October 22nd 04 08:46 AM
Macro Close 2 Ronbo Excel Programming 1 May 5th 04 10:11 PM
Close Macro Ronbo Excel Programming 1 May 5th 04 08:33 PM


All times are GMT +1. The time now is 08:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"