Setting EXCEL columns data type

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am exporting data from ACCESS database to EXCEL. The datasource is a
query.
There are numeric fields in the query but after exporting, the numeric data
type is changed to text.

How do I change the data type of the EXCEL columns before exporting.

I'm using the following statement after loading the data into an array.


oSheet.Range("A2").Resize(irows, icol).Value = vArray
vArray is defined as variant.
 
Marilyn,

You might want to post your question in the Excel group. This is an Access
group, and you question is about excel automation, but I can suggest you
look at the excel object model in the excel programming.

Dan
 
So far the only way I've been able to get around this problem is by creating
a local Access table. I've set up the Access table with the correct data
types. I clear the Access table and then append the query results to the
local table. I then export the local table to Excel vs the query. Excel
seems happy with this solution. Prior to this solution, our workaround was
to have our users use the Text to Columns feature in Excel to fix it
themselves after the export.
 
Back
Top