Access 2000 to Excel

R

Ray Milhon

The company I work for now has a report they require at various times. The
report involves running several queries in MS Access 2000 and exporting the
results to Excel. Then pulling the data from the spreadsheets that were
created from the export and combining them into 1 worksheet and reformatting
various elements. This is a time-consuming process. I have created a sub
procedure in Access that runs the various queries and pulls the data into
recordsets. I am now trying to export those recordsets into a worksheet
placing the elements where needed and reducing the manual effort. I've done
this before but it's been about 5 years. I can open the spreadsheet but I've
forgotton how to place the elements from the recordsets into the specific
Cells. I thought it was as follows

xlwsh.cells(A1) = "Report Title"
xlwsh.cells(A2) = "Col Header1"
xlwsh.cells(B2) = "Col Header2"
xlwsh.cells(A3) = rs1!field1
xlwsh.cells(B3) = rs2!field1
......

But it's not working. What am I missing??
 
E

egerds

Instead of working with each cell 1 at a time.
fill an array with the recordset data.
saving 2 long int's as the field count ( lng_column_count) and record
count (lng_Row_count) that you redimed the array with
xlwsh.range("r" & lng_column_count & "c" & lng_Row_count).value = array
()
 

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