Out of Memory Error

Hap

Well-known Member
Joined
Jul 20, 2005
Messages
647
I am getting an out of memory error when after closing the workbook in the following code. I have an Add-in that opens another workbook and runs other code which opens a form and allows the user to interact. When the form is closed the workbook closes and doesn't save per the code below. As soon as it exits the workbook VBA throws the Out of Memory error. I had previously set the other workbook as an object. I thought maybe it wasn't releasing the memory from the additional workbook open correctly but I'm still getting the error. Any suggestions are greatly appreciated.


Code:
Private Sub CommandButtonHSS_Click()
    
    Dim f As String
    Dim p As String
    Dim r As String
    
    f = "HSS Connection Designer 180611.xlsm"
    p = "H:\WSDATA\eng48\Steel\"
    
    Workbooks.Open (p & f)
    r = "'" & p & f & "'!Module1.Main"
    Application.Run r
    Workbooks(f).Close False
    
End Sub
 

Some videos you may like

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Watch MrExcel Video

Forum statistics

Threads
1,100,053
Messages
5,472,191
Members
406,808
Latest member
Pocher

This Week's Hot Topics

Top