ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Procedure not running automatically... (https://www.excelbanter.com/excel-programming/365334-procedure-not-running-automatically.html)

kartune85[_13_]

Procedure not running automatically...
 

The 'Private Sub Workbook_BeforeClose()' isn't running automatically (or
at all for that matter).

I've got the code in a module of it's own("B4Close") along with the
'Sub CopyData1' procedure. But when I close the Workbook it doesn't
show the MsgBox declared in 'Private Sub Workbook_BeforeClose()' but it
still shows the "Do you want to save..." dialog even tho I've stated
'...DisplayAlerts = False', also inside the 'Private Sub
Workbook_BeforeClose()'.

I haven't called the procedure from anywhere but from what I gathered,
it's not neccessary to call these particular types of procedures.

Kartune85


--
kartune85
------------------------------------------------------------------------
kartune85's Profile: http://www.excelforum.com/member.php...o&userid=35586
View this thread: http://www.excelforum.com/showthread...hreadid=555437


Paul B

Procedure not running automatically...
 
"I've got the code in a module of it's own("B4Close") "

this is event code it has to go in the thisworkbook module

To put in this macro, from your workbook right-click the workbook's icon and
pick View Code. This icon is at the top-left of the spreadsheet this will
open the VBA editor, in Project Explorer double click on thisworkbook, under
your workbook name, if you don't see it press CTRL + r to open the Project
Explorer, then, paste the code in the window that opens on the right hand
side, press Alt and Q to close this window and go back to your workbook, now
this will run every time you close the workbook. If you are using excel
2000 or newer you may have to change the macro security settings to get the
macro to run. To change the security settings go to tools, macro, security,
security level and set it to medium

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"kartune85" wrote
in message ...

The 'Private Sub Workbook_BeforeClose()' isn't running automatically (or
at all for that matter).

I've got the code in a module of it's own("B4Close") along with the
'Sub CopyData1' procedure. But when I close the Workbook it doesn't
show the MsgBox declared in 'Private Sub Workbook_BeforeClose()' but it
still shows the "Do you want to save..." dialog even tho I've stated
'...DisplayAlerts = False', also inside the 'Private Sub
Workbook_BeforeClose()'.

I haven't called the procedure from anywhere but from what I gathered,
it's not neccessary to call these particular types of procedures.

Kartune85


--
kartune85
------------------------------------------------------------------------
kartune85's Profile:

http://www.excelforum.com/member.php...o&userid=35586
View this thread: http://www.excelforum.com/showthread...hreadid=555437





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com