read file from excel

S

SIN

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 <--
 
Top