Page 1 of 1

dc_excel2array issue

Posted: Sun Jul 31, 2011 9:50 am
by BruceN
I'm having an issue with the array created by this. I think the problem is within excel, not Roger's function.

If I have data in a column that is a large number (such as a UPC code or a numeric ID that is 15-20 characters long) and needs to be treated as text (for example one ID might be '123456789012345', and another one could be 'ABC123DEF'), what comes into the array is sometimes numeric and sometimes text but has decimal points even though I format the entire column as text in excel.

Also, if I go into edit on a given field in excel, the data exports correctly.. if I don't it doesn't. Example:

123456789012345
123456789801237
123458890756444

if I click to edit in the first 2 cells, but not the third, the array returned will be (text values):
'123456789012345'
'123456789801237'
'123458890756444.00'

any thoughts??? searching on line shows a lot of people having this same issue with excel formatting.

thanks

Re: dc_excel2array issue

Posted: Sun Jul 31, 2011 5:02 pm
by GeneB
I had the same problem. Look in "User Contributions', topic 'Importing Excel To A Dbf' to see how I handle it.
Gene B

Re: dc_excel2array issue

Posted: Sun Jul 31, 2011 11:40 pm
by Auge_Ohr
BruceN wrote:... but has decimal points even though I format the entire column as text in excel.
how did you "format" Columne ? are Array Element "String" ?

i would use Excel "Marco Editor" before "format" it manuell and than have a look at the Macro.
i "think" it must be

Code: Select all

oSheet:Columns(i):NumberFormat  := "@"

Re: dc_excel2array issue

Posted: Mon Aug 01, 2011 9:24 am
by rdonnay
Make sure that you set the cell to "Text" in Excel.