View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
kewell12 kewell12 is offline
external usenet poster
 
Posts: 3
Default Changing default data format settings when importing CSV files

Thanks very much Murray, I'll give this a go

"Murray" wrote:

Kewell12

Don't know that there is a way to change the formatting, but a macro
could do it.

Put this code in a macro module and see if it works (warning:
untested!)

Sub LoadFile()
Dim FName As String
FName = Application.GetOpenFilename(filefilter:="All Files (*.*),
*.*")
Workbooks.OpenText Filename:=FName, Origin:=xlMSDOS, _
StartRow:=1, DataType:=xlDelimited,
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False,
Comma:=True _
, Space:=False, Other:=True, OtherChar:="""",
FieldInfo:=Array(Array(1, _
1), Array(2, 1), Array(3, 1), Array(4, 1)),
TrailingMinusNumbers:=True
End Sub

Regards

Murray

kewell12 wrote:
Hi, we work with many data files which are saved as CSV files. In some of our
files, the data values are numbers which themselves are comma seperated but
they are encapsulated within text quotes e.g. "25,99999".

When I double click the CSV file and Excel automatically loads the file, the
number format gets changed to 2,599,999 even though the original value was in
a text string. I know I can solve this problem using the import wizard but
when you are working with 30-50 of these files per day I do not want to use
the import wizard all the time.

does anyone have any ideas if I can change the default formatting of the
number that excel is applying?

Thanks!