Compile Error: User-defined type not defined

Moxioron

Registered User.
Local time
Yesterday, 16:52
Joined
Jul 11, 2012
Messages
68
Hello.

I copied some VBA from one database to another. I didn't change anything and I am able to run it fine in the first database. But in the DB I pasted it to, I am received a Compile Error message with the XlApp As Excel.Application area highlighted. What would be causing that? Thanks.

Function OpenAutoCount()
Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
Set xlApp = New Excel.Application
With xlApp
.Visible = True
Set xlWB = .Workbooks.Open("R:\Dept-BR\Consumer Lending\Consumer Lending Databases\Crystal and LoansPQ Reports\Auto Count.xls", , False)
LResult = Trim("AP4:AP50000")
xlApp.ActiveWorkbook.Save
xlApp.Application.Quit
End With
End Function
 
That code uses early binding, which would require the Excel reference be checked in Tools/References.
 
That was it. Thank you sir.
 

Users who are viewing this thread

Back
Top Bottom