ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   why doesnt cancel=true always work? (https://www.excelbanter.com/excel-programming/367403-why-doesnt-cancel%3Dtrue-always-work.html)

Duncan[_5_]

why doesnt cancel=true always work?
 
Hi all,

General niggling point, ive tried to use cancel=true to stop things
happening (like close event and so on) but it always just carried on
and closed/saved/whatever. I just got a little wound up and found ways
around it and then forgot all about it till recently...I tried it on
another pc (one round a friends house) and noticed that it
worked.......strange....

Does anyone know why this is intermittent?

Duncan


Zone

why doesnt cancel=true always work?
 
Duncan, since no one else is answering this, I'll give it a shot. Put
a breakpoint on your line of code that is supposed to cancel by
clicking on the gray area to the left of it. If the code doesn't break
when you run it, then execution is not reaching that point. If it does
break and you debug, you should be able to rest the cursor over your
variables and get values for them. Might be a starting point.
James
Duncan wrote:
Hi all,

General niggling point, ive tried to use cancel=true to stop things
happening (like close event and so on) but it always just carried on
and closed/saved/whatever. I just got a little wound up and found ways
around it and then forgot all about it till recently...I tried it on
another pc (one round a friends house) and noticed that it
worked.......strange....

Does anyone know why this is intermittent?

Duncan



NickHK

why doesnt cancel=true always work?
 
Duncan,
It does work, but for some reason the code is not being executed as you
think.
Follow James' advice to see if the events is being fired.

If not, the run
Application.EnableEvents=true
and try again.

NickHK

"Duncan" wrote in message
oups.com...
Hi all,

General niggling point, ive tried to use cancel=true to stop things
happening (like close event and so on) but it always just carried on
and closed/saved/whatever. I just got a little wound up and found ways
around it and then forgot all about it till recently...I tried it on
another pc (one round a friends house) and noticed that it
worked.......strange....

Does anyone know why this is intermittent?

Duncan




Duncan[_5_]

why doesnt cancel=true always work?
 
Thank you Nick and James for your suggestions,

I will have a go at seeing which events are not being fired through
debugging, Ive noticed that depending on whether I close through my
form or through Excel the workbook_close event doesnt always fire, I
will look into it......

Many thanks

Duncan





NickHK wrote:

Duncan,
It does work, but for some reason the code is not being executed as you
think.
Follow James' advice to see if the events is being fired.

If not, the run
Application.EnableEvents=true
and try again.

NickHK

"Duncan" wrote in message
oups.com...
Hi all,

General niggling point, ive tried to use cancel=true to stop things
happening (like close event and so on) but it always just carried on
and closed/saved/whatever. I just got a little wound up and found ways
around it and then forgot all about it till recently...I tried it on
another pc (one round a friends house) and noticed that it
worked.......strange....

Does anyone know why this is intermittent?

Duncan




All times are GMT +1. The time now is 09:36 AM.

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