I try to use an Excel app but each time I put
Dim xlApp As Excel.Application
I receive this error "user-defines type not defined" Why ?

this is my code

Public Sub ExportToExcel(Rs As Recordset, FileName As String)

Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
'Instantiate your Excel Objects

Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Add()
Set xlSheet = xlBook.ActiveSheet
Dim iRow As Integer
Dim iCol As Integer



Thanks
Redg