Export multiple queries into a single spreadsheet in different range of cells

ria.arora

Registered User.
Local time
Tomorrow, 05:41
Joined
Jan 25, 2012
Messages
109
Dear All,

I need to export multiple queries into a single spreadsheet in different range of cells. Means one query need to be exported from B2:E2 and second query need to be exported from B10:E10. In this way need to export 18 queries' result into one sheet only on different name range.

If anyone has sample VBA code then please help to post it.

Any help would be appreciated. I am using Access 2007 and need to export data into Excel 2003 format.


Thanks a lot for the help.

Regards
Ria
 
Hi Alan,

Sorry I did not get the solution on the blog. Not sure if that link is correct.

If you have the sample code then pls post it in this.

Thanks
 
Got error Item not found in this collection.

/C

cntRow = 2
cntCol = 2
Do While Not rsTmp.EOF
lngCol = 0
For Each varField In rsTmp.Fields
' appExcel.Cells(cntRow, 1) = rsTmp!Status
' appExcel.Cells(cntRow, 2) = rsTmp!DBT_RM_NAME
' appExcel.Cells(cntRow, 3) = rsTmp!GMIS_CODE
' appExcel.Cells(cntRow, 4) = rsTmp!PBC
' appExcel.Cells(cntRow, 5) = rsTmp!USER_LAST
' appExcel.Cells(cntRow, 6) = rsTmp!USER_FIRST

oBook.Worksheets("Sheet1").Cells(cntRow + 1, cntCol + 1) = IIf(cntRow = 0, rsTmp.Fields(cntCol).Name, varField.Value)
cntCol = cntCol + 1
Next
If cntRow > 0 Then rsTmp.MoveNext
cntRow = cntRow + 1
Loop

/C
 
Got error:

Run-time error '3265':

Item not found in this collection.
 

Users who are viewing this thread

Back
Top Bottom