Display status text while macro runs?

D

dgmoore

I have a number of procedures that generate custom reports that take
about 30 minutes to run if Project is not visible and not constantly
repainting the screen. If Project is visible the procedures run quite a
bit longer.

Is there a way to display status text, e.g., via a user form, while the
process runs, but without having Project visible? If my code runs
entirely within a user form module, can it do so with Project hidden?

Thanks
Dave
 
J

John

I have a number of procedures that generate custom reports that take
about 30 minutes to run if Project is not visible and not constantly
repainting the screen. If Project is visible the procedures run quite a
bit longer.

Is there a way to display status text, e.g., via a user form, while the
process runs, but without having Project visible? If my code runs
entirely within a user form module, can it do so with Project hidden?

Thanks
Dave

Dave,
Yes it can be done and I use a similar method for many of my macros when
exporting data from Project to Excel. I keep Excel in the background
until the export is complete and then make it visible. And yes, the code
does run faster that way. Graphic repaint sucks up a lot of processor
time - relatively speaking.

Although I haven't actually minimizing Project or set the visible
property to false while code runs from a userform, I see no reason why
it shouldn't work similarly to how I use it for Excel. I also set
ScreenUpdating and DisplayAlerts to false. For time intensive code I
generally also set up a progress line to show either in the window
caption or on the userform. It does slow execution somewhat but at least
it gives a running visual indicator that something is actually happening.

One other point I would like to mention. If the macros you run were
created by recording they will run slower because most recorded macros
run in foreground processing. That is, objects are selected as the code
runs and this creates graphic overhead. A much more efficient method is
to operate on the objects directly. The code will then run in background
processing and avoids the screen redraw.

Hope this helps.
John
Project MVP
 
R

Rod Gill

Another way which I use every so often is to Create a new, blank project
that sits in the foreground. This stops Project from having to refresh the
screen and I update the name of Task 1 as my status message.

Unfortunately Project doesn't have Excel's ScreenUpdating=False command
(even though I've requested it since Project 2000 onwards!!!@!)
 
D

dgmoore

John,

Thanks for the info. None of the macros I'm running were created by
recording, so I should be ok there.

Cheers
Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top