Excel Memory Error and Userform1 Relaunch When Hitting an Open New Workbook excel 2013

leryt

New Member
Joined
May 11, 2019
Messages
4
So I added this code below to my other codes that initiate. It all worked well until this one was added. What I do is have a button on a sheet that will launch Userform1 on the first workbook. Then a second workbook will open and extract data as appropriate, but on this one sheet I am getting out of memory, which is odd, catastrophic error, and Userform1 tries to launch again. I took this one out of my code and all is working properly again. I need to extract data once a day from this sheet and the code below was suppose to check if this was processed yet and if not, extract the small data set in an external file. Please let me know what you see. I have used similar processes before without the relaunch of my macro. I do not know. I am use to version 2007 and this is 2013 which I am having some adjustments. Thank you.

Code:
Private Sub TableUpdate()
Dim wb, ob As Workbook
Dim ExternalM, ExternalT, stats As Worksheet
Dim TFile, notice As String
Dim DateIn As Range
Dim d As Date

d = Format(Now(), "m/dd/yyyy")

Set wb = ThisWorkbook
Set stats = Sheet6

If d <> stats.Range("B3").Value Then
    Set ExternalT = wb.Worksheets("External")
    Application.ScreenUpdating = False
        Application.CutCopyMode = False
            TFile = "C:\SequenceLock.xlsx"
                Workbooks.Open Filename:=TFile, ReadOnly:=True
                    Set ob = ActiveWorkbook
                     'ERROR OCCURESHERE TO LAUNCH USERFORM1 AGAIN
                      Set ExternalM = ob.Sheets("External")
                        ExternalM.Cells.Copy Destination:=ExternalT.Range("A1")
                            ob.Close (False)
                               Application.CutCopyMode = False
                                 wb.Activate
                                    Set DateIn = stats.Range("B3").Value
                                    DateIn = d
                                     
     notice = ExternalT.Range("I1")
        If notice <> "" Then
             MsgBox notice, Title:="Sequence Notice"
        End If
    
End If

End Sub
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top