Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Issue with Export To Excel

Issue with Export To Excel

Scheduled Pinned Locked Moved Visual Basic
csharphelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mayhem_rules
    wrote on last edited by
    #1

    Hi Guys, I am working on VB.NET/Access. Consider the data 0000011. I am writing the data in CSV format to a file. When I open the file with notepad, the data looks correct. However, when I open in excel, the leading zeros are truncated. It appears as a number. how do you write such data to open correctly in excel. With Best Regards, Mayur

    G 1 Reply Last reply
    0
    • M mayhem_rules

      Hi Guys, I am working on VB.NET/Access. Consider the data 0000011. I am writing the data in CSV format to a file. When I open the file with notepad, the data looks correct. However, when I open in excel, the leading zeros are truncated. It appears as a number. how do you write such data to open correctly in excel. With Best Regards, Mayur

      G Offline
      G Offline
      Gary Noble
      wrote on last edited by
      #2

      You need to convert the cell to 'Text' format and not 'General'. By default excel will automatically exclude leading Zero's in a 'General' Formatted Cell! Highlight the whole column and right click, select 'Format cells' and change the format to 'Text'. Hope this helps. Gary

      M 1 Reply Last reply
      0
      • G Gary Noble

        You need to convert the cell to 'Text' format and not 'General'. By default excel will automatically exclude leading Zero's in a 'General' Formatted Cell! Highlight the whole column and right click, select 'Format cells' and change the format to 'Text'. Hope this helps. Gary

        M Offline
        M Offline
        mayhem_rules
        wrote on last edited by
        #3

        Even if I convert the cell to TEXT, the result is the same. With Best Regards, Mayur

        G 1 Reply Last reply
        0
        • M mayhem_rules

          Even if I convert the cell to TEXT, the result is the same. With Best Regards, Mayur

          G Offline
          G Offline
          Gary Noble
          wrote on last edited by
          #4

          It Will be! You need to use the import wizard in excel and select the cell type to be text. If you load the file then try changing the column to text it will not do anything, as the leading zero's have already been taken out.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups