code not working

E

eric

I don't think my previous message was posted

My VBA code doesn't seem to work when I try to run it.

Private Sub equipexport_Click()
Dim oXL As Excel.Application
Dim oWkb As Excel.Workbook
Dim oWks As Excel.Worksheet
Dim rstSubForm As DAO.Recordset
Dim iRow As Integer

It says "Compile error User-defined type not defined" and
then it points to the second line (Dim oXL As
Excel.Application)

Thank you in advance
 
J

Jean-Paul Viel

Hi,



If you don't run this code in Excel, you need a reference to the library.



Go to Tools > References and add the proper references "Microsoft Excel 10.
lib"
 
V

Van T. Dinh

Yes. It was posted and answered which was:

Have you added the Excel Object Library and the DAO 3.6
Library into the References Collection of your database?

HTH
Van T. Dinh
MVP (Access)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top