Error 430 using .CopyFromRecordset method

G

Guest

Using Access2000, Excel2000, DAO3.6 (version 3.60.3714.5 and 3.60.8618.0)

I created some Excel automation which, up until Friday, was working fine.
Now, I get the error "Runtime error: 430/ class does not support automation
or does not support expected interface"

It fails on the copyfromrecordset method.

Here is the relevant code:
Dim objexcel As Excel.Application
Dim objwkb As Excel.Workbook
Dim objsht As Excel.Worksheet
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set objexcel = New Excel.Application
Set objwkb = objexcel.Workbooks.Open(strTemplateFileName)
objwkb.Sheets("Data").Visible = True

Set objsht = objwkb.Worksheets("Enrollment")
objsht.Select
With objsht
Set rs = db.OpenRecordset("001 Qry Pipeline Enrollment")
.Cells(2, 1).CopyFromRecordset (rs) '<----fails here!!!
.Cells(1, 1).Select
End With
rs.Close
Set rs = Nothing

Our company did a security push, but I'm not sure what exactly went out and
if it's the cause of this issue (seems like it would be) or just
coincidental. When I googled for an answer, they said it might be a
DAO360.dll issue, but I'm not using the version they say has a bug in it.

Any ideas?
Thanks!
-Mark
 
D

David Lloyd

Mark:

Removing the parentheses from the CopyFromRecordset line appears to solve
the error.

For example:

.Cells(2, 1).CopyFromRecordset rs

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Using Access2000, Excel2000, DAO3.6 (version 3.60.3714.5 and 3.60.8618.0)

I created some Excel automation which, up until Friday, was working fine.
Now, I get the error "Runtime error: 430/ class does not support automation
or does not support expected interface"

It fails on the copyfromrecordset method.

Here is the relevant code:
Dim objexcel As Excel.Application
Dim objwkb As Excel.Workbook
Dim objsht As Excel.Worksheet
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set objexcel = New Excel.Application
Set objwkb = objexcel.Workbooks.Open(strTemplateFileName)
objwkb.Sheets("Data").Visible = True

Set objsht = objwkb.Worksheets("Enrollment")
objsht.Select
With objsht
Set rs = db.OpenRecordset("001 Qry Pipeline Enrollment")
.Cells(2, 1).CopyFromRecordset (rs) '<----fails here!!!
.Cells(1, 1).Select
End With
rs.Close
Set rs = Nothing

Our company did a security push, but I'm not sure what exactly went out and
if it's the cause of this issue (seems like it would be) or just
coincidental. When I googled for an answer, they said it might be a
DAO360.dll issue, but I'm not using the version they say has a bug in it.

Any ideas?
Thanks!
-Mark
 
G

Guest

Hi David,

Thanks for the response. Unfortunately no, removing the parenthesis doesn't
solve the problem for me. In fact, that's how I had it initially.

Any other ideas? This is killing me because I have so many automated Excel
reports and now I gotta copy them manually... I got into programming because
I was lazy!

-Mark
 

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