Hi,
I'm seeking to run some VBA code in Excel 2010 on a Windows XP machine. The goal of the code is to take a large Excel file and break it down into a set of distinct files (e.g. Report_Department100, Report_Department200, Report_Department300) which will then be examined and emailed out to the various departments.
Here is the error I get when I attempt to run it: "Compile error: User-defined type not defined." Excel highlights the "Dim DB As Database" line specifically.
Here is the context of the code:
What do you suggest I do to address this problem?
I'm seeking to run some VBA code in Excel 2010 on a Windows XP machine. The goal of the code is to take a large Excel file and break it down into a set of distinct files (e.g. Report_Department100, Report_Department200, Report_Department300) which will then be examined and emailed out to the various departments.
Here is the error I get when I attempt to run it: "Compile error: User-defined type not defined." Excel highlights the "Dim DB As Database" line specifically.
Here is the context of the code:
Code:
Sub CreateFiles()
Dim DB As Database
Dim rst As Recordset
Dim rst2 As Recordset
Dim strSQL As String
Dim DeptID As String
Dim CustID as DAO.QueryDef
Dim FilePath As String