Out of Memory

Created by Damien Zwillinger, Modified on Fri, 1 Sep, 2023 at 2:38 AM by Damien Zwillinger

Applies to:

  • Velixo Classic
  • Acumatica, Cegid, MYOB


Overview

When using an Excel Visual Basic for Applications (VBA) macro to access Velixo functionality, an Out of Memory error can be experienced:

 

Text of the error:

Compile Error:  Out of Memory

 

Cause

Another error is occurring, but Excel's VBA interface is unable to adequately display it but keeps trying until it eventually runs out of memory.

 

 

Resolution

We need to provide a method for displaying the actual error that occurs.

 

Assuming that we originally were using the code shown above...

 

Public Sub Generate()
    Dim Velixo As Velixo_Reports.VBA
    Set Velixo = CreateObject("Velixo.Reports.Vba")
    Velixo.ProcessAllAutoHideRanges
End Sub

 

... here is the corrected VBA code which uses On Error to capture the actual error and redirect to an area of the code for displaying that error:

 

Public Sub Generate() 
    On Error GoTo EH 

    Dim Velixo As Velixo_Reports.VBA 
    Set Velixo = CreateObject("Velixo.Reports.Vba") 
    Velixo.ProcessAllAutoHideRanges 

Done: 
    Exit Sub 

EH: 
    MsgBox Err.Description, vbError 

End Sub

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article