S
Sheldon Penner
My Excel application contains the following code to enter data from an ADO
recordset, rsStats, onto an Excel spreadsheet:
rsStats.Filter = "[DIST_CODE]='" & strTerr & "'"
RecCount = rsStats.RecordCount
..Cells(n, startCol).CopyFromRecordset rsStats
This code is contained within a loop that assigns different values to
strTerr and n. The result is that it returns the various filtered recordsets
at different locations on the spreadsheet.
This works fine in VBA, but now I have to transfer this functionality into a
vbscript that uses Office Automation to instantiate the Excel application,
open the Excel file and insert the data. When the code is run from vbscript,
rsStats.RecordCount returns the correct number of records for each filtering
of the recordset, but CopyFromRecordset always prints the complete,
unfiltered recordset.
Is there some way I can get CopyFromRecordset to recognize the filter when
working through Office Automation?
recordset, rsStats, onto an Excel spreadsheet:
rsStats.Filter = "[DIST_CODE]='" & strTerr & "'"
RecCount = rsStats.RecordCount
..Cells(n, startCol).CopyFromRecordset rsStats
This code is contained within a loop that assigns different values to
strTerr and n. The result is that it returns the various filtered recordsets
at different locations on the spreadsheet.
This works fine in VBA, but now I have to transfer this functionality into a
vbscript that uses Office Automation to instantiate the Excel application,
open the Excel file and insert the data. When the code is run from vbscript,
rsStats.RecordCount returns the correct number of records for each filtering
of the recordset, but CopyFromRecordset always prints the complete,
unfiltered recordset.
Is there some way I can get CopyFromRecordset to recognize the filter when
working through Office Automation?