+ Reply to Thread
Results 1 to 4 of 4

changing import text default from general to text

  1. #1
    Registered User
    Join Date
    06-15-2008
    Posts
    5

    changing import text default from general to text

    I want to import text files into excel. I need all columns to be imported as text, so as to keep them looking exactly as they are in the text file. I had no problem at all doing this manually, by choosing, in the import text wizard to import all columns as text, and not as general, which is the default. But I would like this to be done automaticaly. Is there any way to change the default for importing text to "text" instead of "general"?
    Thanks to anyone who can help me on this.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello shoshanako,

    Welocme to the Forum!

    You can automatically load the files and import them using a QueryTable in VBA. In your VBA code you can set each column's format property using the TextFileColumnDataTypes property. If you need help with code, let me know.

    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    06-15-2008
    Posts
    5
    Thanks Leith,
    This sounds like a good idea. The problem is that I need this to work for any number of columns. In other words, if I had 3 columns in my text file, and in a few months it is changed to 4 columns, I don't want to have to enter the code and change it. Is there any way to do this so it would work for any number of columns.
    Thanks for your help

  4. #4
    Registered User
    Join Date
    02-17-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: changing import text default from general to text

    Hello Leith

    When I export data from .csv file to .excel file then all the preceding zero's disappear and the code 0010 display's like 10. I know I can manually import data from csv to text(option "fromtext" in excel) but i want to do it automatically.

    I was trying to write a macro so that when I open any .csv file in excel , it automatically convert all column type to text and display the code as 0010. Could u please explain me how could i achieve this.

    and send me the code also, so that i can directly run it on VBA.

    Thanks in advance

    Sincerely
    Sandhya Gupta

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1