G
Guest
Sorry to post this again, but as I had a reply that was
not answering my particular query I felt I should post
again as those posts that receive replies rarely get
another reply.
Hope you guys can help with this!
Many thanks (as always)
Lee
Here's my message:
Hi everyone,
I know I'm being totally dim here but I've just got a
mental block about this. Below is part of some code to
insert the results of a query into an Excel worksheet.
My problem is I want the process to start from the 2nd
row onwards rather than row 1 as there are column
labels
in row 1.
What am I doing wrong here? Here's the code extract:
column = 1
' Loop through the Microsoft Access field names and
create
' the Microsoft Excel labels.
For row = 0 To Rs.Fields.Count - 1
CurrentValue = Rs.Fields(row).Name
Sheet.cells(row + 1, column).Value = CurrentValue
Next row
column = 2
' Loop through the Microsoft Access records and copy
the
records
' to the Microsoft Excel spreadsheet.
Do Until Rs.EOF
For row = 0 To Rs.Fields.Count - 1
CurrentField = Rs(row)
Sheet.cells(row + 1, column).Value =
CurrentField
Next row
Rs.MoveNext
row = row + 1
Loop
Any help would be really appreciated.
Thanks!!
Lee
not answering my particular query I felt I should post
again as those posts that receive replies rarely get
another reply.
Hope you guys can help with this!
Many thanks (as always)
Lee
Here's my message:
Hi everyone,
I know I'm being totally dim here but I've just got a
mental block about this. Below is part of some code to
insert the results of a query into an Excel worksheet.
My problem is I want the process to start from the 2nd
row onwards rather than row 1 as there are column
labels
in row 1.
What am I doing wrong here? Here's the code extract:
column = 1
' Loop through the Microsoft Access field names and
create
' the Microsoft Excel labels.
For row = 0 To Rs.Fields.Count - 1
CurrentValue = Rs.Fields(row).Name
Sheet.cells(row + 1, column).Value = CurrentValue
Next row
column = 2
' Loop through the Microsoft Access records and copy
the
records
' to the Microsoft Excel spreadsheet.
Do Until Rs.EOF
For row = 0 To Rs.Fields.Count - 1
CurrentField = Rs(row)
Sheet.cells(row + 1, column).Value =
CurrentField
Next row
Rs.MoveNext
row = row + 1
Loop
Any help would be really appreciated.
Thanks!!
Lee