程序太大

Sou*_*rav 17 error-handling vba ms-office

我收到此错误消息 - Procedure too large- 在VBA中.这个错误的原因和出路是什么?

Han*_*son 17

您可能有一个或多个巨大的程序/功能,我认为VBA的每个程序限制为64k或更高.

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

所以不要:

 Sub GiantProcedure()
      ... ' lots and lots of code
 End Sub
Run Code Online (Sandbox Code Playgroud)

你有类似的东西:

 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
Run Code Online (Sandbox Code Playgroud)

  • 这个错误直接发生在20世纪80年代...... VBA已经达到了古老......面掌的新水平 (7认同)

Wix*_*Wix 5

您的编译过程不能超过64kb.你应该把它分解成不同的子程序.

http://msdn.microsoft.com/en-us/library/Aa264541