Efficent VBA Code - Variable & Memory Questions
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Efficent VBA Code - Variable & Memory Questions

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
Oberer
Guest





Posted: Sat Jan 29, 2005 1:56 am    Post subject: Efficent VBA Code - Variable & Memory Questions Reply with quote

I'm asking for some verification & clarification on a couple of codiing questions...

1) I've always heard that it's more efficent to to process as few "."'s as possible. In other words, set a referenced to ThisDrawing.Blocks if using a for/each loop.

Example:
For each oBlock in ThisDrawing.Blocks vs
next
set Blocks = ThisDrawing.Blocks
For each oBlock in Blocks
next

However, I see plenty of code (and no suggestions to "tighten it up") that make liberal use of extended hiearchies.

2)"Releasing Variables" - I've always taken the time to Set ObjectVar = Nothing at the end. i rarely see this, and i know it's supposed to happen by default. is this a waste of time?

Back to top
Frank Oquendo
Guest





Posted: Sun Jan 30, 2005 3:43 am    Post subject: Re: Efficent VBA Code - Variable & Memory Questions Reply with quote

Oberer wrote:

Quote:
However, I see plenty of code (and no suggestions to "tighten it up") that make liberal use of extended hiearchies.

Let's face it: if you have to squeeze every last drop of performance out
of your application, you won't be using VB or VBA.

Quote:
2)"Releasing Variables" - Is this a waste of time?

Mechanically speaking, yes. However, the benefit is clarity and that's
hardly a waste of time.

--
There are 10 kinds of people: those who understand binary and those who
don't.
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Access Forum - Microsoft Office Forum - Electronics

Contact Us Powered by phpBB