read file from excel

G

Guest

hi,
i am triyng to read from excel file when i run the program i get error:
"user defined type not defined"

Private Sub import_data_Click()
Dim xlApp As Excel.Application
Dim xlSht As Excel.Worksheet
Dim xlRng As Excel.Range

thanks.
 
S

Stefan Hoffmann

hi,

SIN wrore:
i am triyng to read from excel file when i run the program i get error:
"user defined type not defined"
Dim xlApp As Excel.Application
You need to set a reference to the Excel Library as you are using early
binding, so that the compiler can work type safe with these objects.

In the release version you should switch to late binding to aviod to
reset the reference when running under a different Excel version. To do
this remove the reference and change your code:

Dim xlApp As Excel.Application

Set xlApp = New Excel.Application

becomes

Dim xlApp As Object

Set xlApp = CreateObject("Excel.Application")


mfG
--> stefan <--
 

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

Similar Threads

error 438 2
I need to export a query to Excel pivot table 3
excel file is locked 3
Excel Automation 3
Create Excel file with VBA in Access 7
Excel automation 2
CopyFromRecordset 1
What's wrong with this code 2

Top