BOLD font slows VBA performance in Excel 2003

J

Juwi_uk

In investigating slow performance in one of my projects (excel 2003) I've
found something interesting which maybe one of you may be able to comment on.

A simple worksheet_change event to change the interior color, font color and
highlight bold a cell when its value is changed.

with target.cells
..interior.color = RGB (...colour codes etc...)
..font.color = vbBlue
..font.bold = True
end with

Sometimes running the code and it returned control within a second, other
times it went away for seconds (count to five!!) before returning control.
Other times first 1 - 5 changes are fast and OK, then they slow down, then
the next batch would be OK again. Spent hours trying to analyse and improve
performance in the code

In the end I started commenting out lines one at a time until I saw an
improvement.

What do you know, commenting out the .bold line suddenly put everything back
to lightening speed and consistently too. I then messed around with italic
and underline settings and both retained a lightening fast passing of control
back to the user. Final control was to put the .bold line back; what do you
know, wait increased to 3+ seconds again. I'm sure at one time I also saw the
BOLD toolbar icon "flicker" too but not expected given I had screen updating
set to false.

Suffice it to say I'm currently showing changed fields with background
color, font colour and underline set at the moment.

Any ideas. Possibly a bug in Excel 2003 by chance?

Regards

Julian
 
D

Dave Peterson

How about a complete guess????

Maybe it's caused by excel going off to the printer driver to see how that cell
should be displayed.

If you change to a different printer driver (install a different one--even if
you don't have the physical hardware), maybe you could test it out.

And if there's a difference, maybe going to your printer's site and getting a
new driver would help.
 
D

Dave Peterson

If I recall correctly, someone else posted a similar problem.

When they switched from a network printer to a local printer the problem went
away.

Maybe you can do that, well, if it applies.
 
J

Juwi_uk

Dave,

Many thanks for the tip; I'll need to try that and report back.
Interestingly enough I was working offline on my business laptop at the time
so network printers (my default printer is a network printer) may be causing
the problem as you say.

It's interesting though that it does affect for example choosing italic,
underline etc just bold. I would have thought the first 2 would alos ned to
check the printer driver too.

Regards

Julian

Dave Peterson said:
If I recall correctly, someone else posted a similar problem.

When they switched from a network printer to a local printer the problem went
away.

Maybe you can do that, well, if it applies.
 
D

Dave Peterson

I try not to think when I can test <vbg>.

Please post back with your results. It should be interesting and google will
have it for the next victim, er, person.

Juwi_uk said:
Dave,

Many thanks for the tip; I'll need to try that and report back.
Interestingly enough I was working offline on my business laptop at the time
so network printers (my default printer is a network printer) may be causing
the problem as you say.

It's interesting though that it does affect for example choosing italic,
underline etc just bold. I would have thought the first 2 would alos ned to
check the printer driver too.

Regards

Julian
 

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