Try the site Rich refers to for more details but basically you need to tell Excel that you wish to use DAO you do this by accessing the VB toolbar in Excel and opening the code editor, which is where you type the VBA. click Tools on the menu bar and from the list select References click alongside Microsoft DAO 3.51 object library. This allows Excel to recognise the code that I described earlier, without clicking this Excel just doesn't recognise the keywords - i.e Database, Recordset etc. Have a go and if you get stuck come back to us.
Good Luck,
Jon.