Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
MissM
 
Posts: n/a
Default warning or message before saving spreadsheet

I would like to have a message or warning to show up before saving a
spreadsheet template I've made if certain cells have been left empty. Is that
possible?
  #3   Report Post  
Duke Carey
 
Posts: n/a
Default

Yes it is.

Right click on a sheet's tab and choose View Code. In Project Explorer (if
it isn't displayed select it from the View menu) double click ThisWorkbook
under your template's name.

Use code something like (change A1 & B1 to reflect the cells that are of
concern to you)
===========================================

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Range("A1") = "" Or Range("B1") = "" Then
MsgBox "Must complete cells A1 & B1 before closing" _
, vbCritical, "Error"
Cancel = True
End If

End Sub

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
If Range("A1") = "" Or Range("B1") = "" Then
MsgBox "Must complete cells A1 & B1 before closing" _
, vbCritical, "Error"
Cancel = True
End If

End Sub

===========================================
"MissM" wrote:

I would like to have a message or warning to show up before saving a
spreadsheet template I've made if certain cells have been left empty. Is that
possible?

  #4   Report Post  
Daniel CHEN
 
Posts: n/a
Default

Try something like:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Range(A1) = "" Then
MsgBox "Err"
End If
End Sub

===== * ===== * ===== * =====
Daniel CHEN

Spreadsheet/VBA Specialist

www.Geocities.com/UDQServices
Your "Impossible" Task Could Be Someone Else's "Piece of Cake"
===== * ===== * ===== * =====


"Don Guillett" wrote in message
...
look in the ThisWorkbook module for before close

--
Don Guillett
SalesAid Software

"MissM" wrote in message
...
I would like to have a message or warning to show up before saving a
spreadsheet template I've made if certain cells have been left empty. Is

that
possible?





Reply
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
how do i disable warning when saving file in csv format? Anatoly Larkin Excel Discussion (Misc queries) 0 March 16th 05 09:21 PM
Warning message Paul Excel Discussion (Misc queries) 1 March 11th 05 11:07 PM
Updating 1 spreadsheet from another Sal Excel Worksheet Functions 4 December 17th 04 11:03 PM
Error Message Appearing JaneC Excel Discussion (Misc queries) 1 December 6th 04 11:40 PM
Error Message appearing when saving a file JaneC Excel Discussion (Misc queries) 0 November 25th 04 10:35 PM


All times are GMT +1. The time now is 11:45 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"