程序太大 [英] Procedure Too Large

查看:166
本文介绍了程序太大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到这个错误消息 - 过程太大 - 在VBA中。这个错误的原因和出路是什么?

解决方案

你可能有一个或多个巨大的程序/功能,我认为VBA限制为64k或每个程序的某些东西。



您可以通过将该过程拆分为多个过程来修复,然后可以通过一个过程调用该过程。

所以而不是:

  Sub GiantProcedure()
.. 很多很多代码
End Sub

你会有一些像: / p>

  Sub GiantProcedure()
...'一点通用代码
Proc1()
Proc2()
Proc3()

End Sub

Sub Proc1()
...'相当多的代码
End Sub

Sub Proc2()
...'相当多的代码
End Sub

Sub Proc3()
...'相当多的代码
End Sub


I received this error message -Procedure too large - in VBA. What is the reason and way out for this error?

解决方案

You probably have one or more gigantic procedures/functions and I think VBA has a limit of 64k or something per procedure.

You fix it by splitting that procedure up into multiple procedures that can then be called by the one procedure.

So instead of having:

 Sub GiantProcedure()
      ... ' lots and lots of code
 End Sub

You'd have something like:

 Sub GiantProcedure()
      ... ' a little bit of common code
      Proc1()
      Proc2()
      Proc3()

 End Sub

 Sub Proc1()
      ... ' quite a bit of code
 End Sub

 Sub Proc2()
      ... ' quite a bit of code
 End Sub

 Sub Proc3()
      ... ' quite a bit of code
 End Sub

这篇关于程序太大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆