Monday, 15 August 2011

What's the lifetime of Application.ScreenUpdating value in Excel 2010? -



What's the lifetime of Application.ScreenUpdating value in Excel 2010? -

as far know application.screenupdating = true value maintained until application.screenupdating = false set. what's 'lifetime' of value? while procedure it's called starts , finish, while worksheet opened, or?

made class maintain screenupdating value consistent needs:

init class set screenupdating = false at end of procedure or in case of error restore value true.

the class handles case ok.

some times need opposite:

init class set screenupdating = true

at end of procedure or in case of error restore value false.

i'm having problem here; class sets value screenupdating = false, when class gets 'actual' value of screenupdating true. there no other procedures or addins changing value.

have prepared test sheet show points above. select value screenupdating dropdown above "sucaller" button.

select false , press button. value before setting false true expected. test info filled procedure showing screenupdating new value (false). after info fill, value reset true. press button 1 time again , 'actual' value true expected. do many times , values should fine.

now select true , press button.

value before setting true true expected (which value above) test info filled 1 time again showing screenupdating new value (true) after info fill, value reset false. press button 1 time again , 'actual' value true not false.

the class negate new value define restore value, result confuses me on lifetime or how screenupdating value should set.

am doing wrong in class or missing basic theory?

class module: applicationscreenupdate

test module: test

test sheet tia, oscar.

so far i'm aware behaviour design (but don't have quotable source that).

while experienced developer expect setting remain, inexperienced 1 not realise they'd done , think excel broken if tried manually set info sheet after macro completed.

something seek disable application events can reset value, may want seek writing value after set updating false suspect value appear after macro done.

excel-vba

No comments:

Post a Comment