Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open csv file with all values as text
Hi,
When excel opens my csv file, the numbers in it are automatically changed to actual numbers, when I want them displayed as text/strings. The problem with this is that, i.e my string "00500" is changed to the value 500 when the file is opened, and will remain as 500 when the file is saved again. Does someone have some code which will prompt the user to select a csv file, then open the file with all values as text/strings?? Cheers Tony |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open csv file with all values as text
Change the extension to .txt instead of .csv and then open it in excel. Walk
through the text import wizard with the macro recorder turn on. In the last dialog indicate which columns should be treated as text. complete the import and turn off the macro recorder. In your code, add code at the top to copy the file and rename the copy with a .txt extension. Then open that (and delete it later if necessary). Even with recorded code, it you open a file with a .csv extention, your settings will be ignored. -- Regards, Tom Ogilvy "bony_tony" wrote: Hi, When excel opens my csv file, the numbers in it are automatically changed to actual numbers, when I want them displayed as text/strings. The problem with this is that, i.e my string "00500" is changed to the value 500 when the file is opened, and will remain as 500 when the file is saved again. Does someone have some code which will prompt the user to select a csv file, then open the file with all values as text/strings?? Cheers Tony |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Open CSV file, format data and write output to a text file. | Excel Programming | |||
How do I import text file, analyze data, export results, open next file | Excel Programming | |||
External link only works for numbers -- for text values, #N/A is displayed unless linked file is open | Links and Linking in Excel | |||
Excel VBA - open text file, replace text, save file? | Excel Programming | |||
Open delimited text file to excel without changing data in that file | Excel Programming |