With...End With blocks

  • Thread starter Thread starter Casey Brown
  • Start date Start date
C

Casey Brown

Does anyone know how it affects performance to use With...End With blocks?
For instance:

With myShape.textframe.textrange.font
.bold = false
....etc
End With

Thanks in advance!
-Casey
 
Does anyone know how it affects performance to use With...End With blocks?
For instance:

With myShape.textframe.textrange.font
.bold = false
....etc
End With

As compared to what, Casey?

According to the docs I've read, it's supposed to be faster to do

With Long.Drill.Down.Through.Object.Model.To.Obejct.Reference
.Property = xxx
.AnotherProperty = yyy
' and so on
End With

than to do

Long.Drill.Down.Through.Object.Model.To.Obejct.Reference.Property = xxx
Long.Drill.Down.Through.Object.Model.To.Obejct.Reference.AnotherProperty =
yyy
and so on

I suspect you'd have to have a really fastmoving stopwatch or a very slow
computer to see much difference under normal circumstances. On the other
hand, it makes the code so much easier to read with you do it with With than
when you do without. ;-)
 
Yes--sorry. As opposed to a long drill down like you wrote. I meant to
write that, but I guess that's what I get when I post so late at night!

Thanks very much, Steve!
 
Back
Top