LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default BeforeSave and Close help

I have the following code in This Worksheet, which works fine. The problem
is that if someone makes a change to the file and clicks the "close" button,
they receive the normal, "do you want to save changes to the file . . " If
they click "yes", and the below test is true then the below msg, "You must
complete the highlighted fields" appears, which is also fine. But if a user
clicks, "OK" to that message, the close prompt, "do you want to save.. comes
up again, the user clicks Yes, then the message below comes up again, and
they both keep appearing.

How can I change or add to the code that will allow a user to click Yes when
asked if he or she wants to save changes and OK to the below message only
once?

Thanks for your help.




Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

With Worksheets("Drawing Notice (Main Sheet) 1")

If .Range("C16").Value = "0" Or .Range("C16").Value = "" _
Or .Range("E16").Value = "1" Or .Range("E16").Value = "" _
Or .Range("G16").Value = "1" Or .Range("G16").Value = "" _
Or .Range("I16").Value = "1" Or .Range("I16").Value = "" _
Then
MsgBox "You must complete the highlighted fields."
Cancel = True
End If
End With
End Sub

 
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
BeforeSave Steven Excel Programming 2 January 21st 06 05:37 PM
BeforeSave question RPIJG[_86_] Excel Programming 7 November 11th 05 06:23 PM
beforesave and beforeclose Adam Harding Excel Programming 2 July 25th 05 11:11 AM
BeforeSave Sub Phil Hageman[_3_] Excel Programming 6 January 14th 04 10:12 AM
VBA - BeforeSave - NEED HELP HRobertson Excel Programming 2 October 23rd 03 06:50 PM


All times are GMT +1. The time now is 08:39 AM.

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"