Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Check before closing Excel

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Check before closing Excel

Great, thanks. I was working in a standard module.

All works well now, cheers


-----Original Message-----
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?


.

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
Closing workbooks w/o closing Excel Barb in MD Excel Discussion (Misc queries) 3 February 15th 10 06:42 PM
Closing excel Noah Excel Worksheet Functions 1 October 23rd 07 04:01 AM
Closing Excel Chad Excel Discussion (Misc queries) 2 March 18th 05 03:57 PM
closing Excel in VBA Jeff[_29_] Excel Programming 1 April 7th 04 08:56 AM
closing excel after closing a workbook CWalsh[_2_] Excel Programming 3 January 21st 04 03:33 PM


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