excel vba - How to add macro to progress bar -


i have macro makes progress bar in status bar, can not how add macro it.

i.e if have sub, say, sub longexacutiontime() how apply showprogress it

i tried changing 'application.wait + timevalue("00:00:01") '<– replace line own code something this

call longexacutiontimelongexacutiontime executes longexacutiontimelongexacutiontime 10 times (once each iteration of loop)

this seems should simple , maybe not getting it

any insight appriciated

thanks

sub showprogress() dim strbar string dim lngloop long   'make statusbar visible application.displaystatusbar = true strbar = string(0, chrw(&h25a0)) & string(10, chrw(&h25a1)) application.statusbar = strbar & "starting…" application.wait + timevalue("00:0:01")   lngloop = 1 1      strbar = string(lngloop, chrw(&h25a0)) & string(10 - lngloop, chrw(&h25a1))      application.statusbar = strbar & " processing…"     'application.wait + timevalue("00:00:01") '<– replace line own   code            next  'relinquish statusbar application.statusbar = false end sub 

i think you're looking this:

sub showprogress(strmessage string)      'make statusbar visible     application.displaystatusbar = true     application.statusbar = strmessage  end sub  public sub longexecutiontime()      'about start     call showprogress("starting...")      'run other code.  i've put wait of 5 seconds in can see status bar saying "starting..."     application.wait + timevalue("00:00:05")     'process stuff     call showprogress("processing...")      'run other code.  i've put wait of 5 seconds in can see status bar saying "processing..."     application.wait + timevalue("00:00:05")      call showprogress("finishingup..")     'same wait     application.wait + timevalue("00:00:05")      'turn off statusbar     application.displaystatusbar = false  end sub 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -