xlCopyFromRS - funny formatting of resulting spreadsheet

  • Thread starter Bill Reed via AccessMonster.com
  • Start date
B

Bill Reed via AccessMonster.com

I used the method posted in this forum to put an Access recordset into an
Excel Workbook. I finally got it doing just about everything I need it to
do, but there's one problem left. Some of the recordsets passed to the
worksheets have a date in the 1st column, numbers in the 2nd and 3rd
columns, and text in the 4th column. Some have numbers int the 1st 2
columns and text in the 3rd column. The fact is, there is no way of knowing
what datatypes will be in any given field of the recordset passed to the
function, as it will be used for any recordset that needs to be exported to
excel.

It appears that after the recordset is pasted, Excel looks at the data in
the 1st column. Whatever it's datatype appears to be, it formats the
succeeding columns with the same data formatting, until it hits a text
column. Because, in the 1st scenario described above, the #s in the 2nd and
3rd columns are treated as serial dates and formatted as short dates (like
9/26/1918), as in the 1st column. In the 2nd scenario, the 2 columns are
formatted properly as #s, not serial dates.

Does anybody know what Excel is doing here? How can I get it to stop
interpreting the data passed to it?

Thanks,

Bill
 

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