Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2003
    Posts
    16

    Red face Unanswered: Exporting to excel big numbers

    Hi all,
    sorry my english.
    Well i have a text field with a number with lenght 21 chars. (Exmple: Number:123456789101112131415) When i export this field to excel X.Cells(iLine, i + 1).Value = Number , it appears 123456789101112000000. If i do this way, X.Cells(iLine, i + 1).Value = Number & "a" it appears 123456789101112131415a The cell doesnt format it self into number.
    Well i cant figure it out how to format a excel cell in text by code in access
    Could someone help me on this?
    Ty all

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    Handy hint - if you don't know how to do something in Excel or Word - record a new macro of you performing whatever you want to do and then view the code. That's how I got this - it seems to work fine:

    Code:
        exSheet.Cells(6, 6).NumberFormat = "@"
        exSheet.Cells(6, 6).Value = "123456789101112131415"
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    You are trying to enter a number with 21 digits of precision into excel.
    The maximum number of digits excel allows is 15.

    For more info see Excel Help. Look up "Calculation specifications" under the topic "Excel specifications and limits."

    You could use VBA code to force this number to a text string before exporting it. But then it would be a character string in Excel, not a number.


    Hope that helps
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  4. #4
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    If you want to export to Excel and you don't want Excel to try to make any format assumptions/changes then put a ' in front of the data. When it displays in Excel it displays exactly how you type it, or in your case how you export it.

  5. #5
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    Good point DC. Prefixing a single quote is better than adding a suffix.
    Either way it forces the result in excel to be a character string. But I
    don't know if PAFF was hoping to do some calculations with the numbers
    once they are in excel.

    Basically, you are trying to enter a number with 21 digits of precision into
    excel. The maximum number of digits excel allows is 15.

    So... why do you want to export?

  6. #6
    Join Date
    Nov 2003
    Posts
    16

    Smile Ty All

    Hi, ty all by the tips.
    I whant to export to excel in char not need to do calculations, so ty all again
    why didnt i think in put ' ....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •