Procedure too large

  • Thread starter Thread starter David
  • Start date Start date
D

David

Hi Group,

I am getting a message, "Procedure too large", there is a limit on the
amount of code that be be executed? This means I have to eliminate some of
the code?

Thanks,
David
 
If you are getting a message that a procedure is too large for the compiler,
then your procedure is *definitely* too large by any other measure. There
is a limit imposed by the compiler, but well-written code should never
approach that limit. You don't have to "eliminate" any code, but you need to
move code out that procedure and put it into a procedure that is called by
the main procedure. E.g., instead of

Sub AAA()
' do lots of stuff for task #1
' do lots of stuff for task #2
' do lots of stuff for task #3
End Sub

use structured code like

Sub AAA()
CallToOtherProcForTask1
CallToOtherProcForTask2
CallToOtherProcForTask3
End Sub

Sub CallToOtherProcForTask1
' code for task 1
End Sub

Sub CallToOtherProcForTask2
' code for task 2
End Sub

Sub CallToOtherProcForTask3
' code for task 3
End Sub



--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
Thanks Chip. I did a lookup on "Procedure too large" and this is what the
partners in crime suggested also. And it works great.
 

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

Back
Top