PC Review


Reply
Thread Tools Rate Thread

Can I stop the close method in an auto close macro

 
 
=?Utf-8?B?UGF1bA==?=
Guest
Posts: n/a
 
      17th Nov 2006
I have an auto close macro running on a file that demands certain cells are
complete before closing.

Is there a way of stopping the close method within the auto close macro when
the data is not present.
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      17th Nov 2006
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'do your test and if true
Cancel = True

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

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Paul" <(E-Mail Removed)> wrote in message
news:73AC68EF-372C-4E05-B13C-(E-Mail Removed)...
> I have an auto close macro running on a file that demands certain cells

are
> complete before closing.
>
> Is there a way of stopping the close method within the auto close macro

when
> the data is not present.



 
Reply With Quote
 
=?Utf-8?B?UGF1bA==?=
Guest
Posts: n/a
 
      17th Nov 2006
Bob - many thanks for your help - this is absolutely what I needed.

"Bob Phillips" wrote:

> Private Sub Workbook_BeforeClose(Cancel As Boolean)
> 'do your test and if true
> Cancel = True
>
> 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
>
> Bob Phillips
>
> (replace somewhere in email address with gmail if mailing direct)
>
> "Paul" <(E-Mail Removed)> wrote in message
> news:73AC68EF-372C-4E05-B13C-(E-Mail Removed)...
> > I have an auto close macro running on a file that demands certain cells

> are
> > complete before closing.
> >
> > Is there a way of stopping the close method within the auto close macro

> when
> > the data is not present.

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop Macro On Close Event =?Utf-8?B?TmljayBoZnJ1cG4=?= Microsoft Access Form Coding 1 18th Mar 2007 12:36 PM
On Close Macro - stop warning message M Shannon Microsoft Excel Programming 2 2nd Oct 2004 04:04 PM
Run auto macro on workbook close sgrech Microsoft Excel New Users 1 18th Sep 2004 04:28 PM
Close all programs / Shut Down windows does not auto close outlook =?Utf-8?B?TUtlcw==?= Microsoft Word Document Management 2 22nd Aug 2004 11:11 PM
Macro for Auto Close =?Utf-8?B?RGVubmlzIEM=?= Microsoft Word Document Management 1 21st Apr 2004 09:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:12 AM.