excel - Automation Error with Range.Recordset method -
i'm running issue when executing line of code, contained in userform:
dim rs adodb.recordset set rs = createobject("adodb.recordset") 'omitting querystring , connection parameters - i'm highly issue doesn't lie there rs.open querystring, cn 'declare object dim classcutcells range 'the next 2 lines 1 in actual code, broke here readability set classcutcells = reisws.range(reisws.cells(classcutrow, classcutcol), _ _ reisws.cells(classcutrow + rs.recordcount, classcutrow + rs.fields.count)) 'the following line produces error classcutcells.copyfromrecordset (rs)
when click event goes off, error:
run-time error '430': class not support automation or not support expected interface.
my current references include:
visual basic applications microsoft excel 14.0 object library ole automation microsoft forms 2.0 object library microsoft office 14.0 object library microsoft scripting runtime microsoft windows common controls 6.0 (sp6) microsoft visual basic applications exentisibility 5.3 microsoft activex data objects 6.0 library
when step in debug, , pass classcutcells.copyfromrecordset (rs) immediate window, code works without hitch, , data dropped desired range. i'm thinking reference issue, have not found online after few days of looking. ideas?
apparently when call copyfromrecordset(rs) method parentheses, expects variant. moved rs out of parentheses , works. if had gotten type error instead of automation error would've been solved last week.
Comments
Post a Comment