Error 430

S

stelios

Hi,

I use the following Code to export data from a recordset to an Excel
workbook.
In my PC everything is fine, I have no errors, BUT when I run it in another
PC I get the Following error:
"Error 430: Class does not support Automation or does not support expected
interface".

function x(){
........
Set objXL = New Excel.Application
Set objWkb = objXL.Workbooks.Open(WKB_PATH & XLT_NAME)
objWkb.SaveAs (WKB_PATH & WKB_NAME)
objXL.Visible = True
.........
Set objSht = objWkb.Worksheets(SHT_NAME)
.........
objSht.Range(objSht.Cells(4, 1), objSht.Cells(4,
FieldsCount)).CopyFromRecordset STAT_RS '<-Error 430
.........
}


Any Idea what is going wrong? (I have in both PC office 2003 and Windows XP,
and reference in Microsoft Excel 11.0)

Thanks!
 
S

stelios

Hi,

Is there a way to make it work in any PC? The other PC I tested it had the
same Excel version!

Thanks!
 
D

Douglas J. Steele

Consider using Late Binding.

Rather than setting a reference to Excel and using code like

Dim objXL As Excel.Application

Set objXL = New Excel.Application

you'd use

Dim objXL As Object

Set objXL = CreateObject("Excel.Application")

One issue is that any Excel-related constants you might be using are now
undefined, so that you need to provide their values to your program.

Tony Toews has some information about late binding at
http://www.granite.ab.ca/access/latebinding.htm
 
Top