Check before closing Excel
Hi
try the following procedure in your workbook module (not in a standard
module):
Private Sub Workbook_BeforeClose(Cancel As Boolean)
with me.worksheets("sheet1").range("A1")
if .value="" then
msgbox "cell A1 on sheet1 not filled, cancel closing"
cancel=true
exit sub
end if
end with
'now your code
End Sub
--
Regards
Frank Kabel
Frankfurt, Germany
Keefy Boy wrote:
I am using the Auto_Close procedure to perform several
actions before the workbook is closed. I no want to add
one hich checks if a specific field has been filled in. If
it has not, I want the Workbook not to close.
Any ideas?
|