With...End With blocks

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
 
S

Steve Rindsberg

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. ;-)
 
C

Casey Brown

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!
 

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