Forcing Excel to stop calculating after error in function -


i've got function defined called on 1000 times on spreadsheet (looks price database) spreadsheet opened in environment database unavailable. when happens, i've got error code handle it, pushes message box.

i'd way stop excel calculation if first 1 fails, things can fixed. i'd pop message box gives option stop calculation.

is there way make happen? of now, pops message box 1000 times, , lot of time ctrl+break (some keyboards not have break key) or esc not stop running because goes quick break in...

errorhandler: ' clean if not rst1 nothing     if rst1.state = adstateopen rst1.close end if set rst1 = nothing  if not con1 nothing     if con1.state = adstateopen con1.close end if set con1 = nothing  if err <> 0     msgbox err.source & "-->" & err.description, , "error" end if   end function 

you can use label , divert label using goto. see below code.

on error goto errorhandler   = 1 / 0  errorhandler: ' clean if not rst1 nothing     if rst1.state = adstateopen rst1.close end if set rst1 = nothing  if not con1 nothing     if con1.state = adstateopen con1.close end if set con1 = nothing  if err <> 0     msgbox err.source & "-->" & err.description, , "error"     goto exit_func end if  exit_func:  end function 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -