Opening semicolon delimited CSV file

后端 未结 8 1933
我寻月下人不归
我寻月下人不归 2020-12-18 07:57

How does one open a semicolon delimited CSV file with VBA in Excel 2000?

Sample data

An ID;TEST20090222
A Name;Firstname Surname
A D         


        
相关标签:
8条回答
  • 2020-12-18 08:50

    I find that this works for me in Excel 2000:

    Workbooks.OpenText filename:=myFilename, _
        DataType:=xlDelimited, Semicolon:=True
    
    0 讨论(0)
  • 2020-12-18 08:51

    Here's the OpenText method from Excel 2000:

    OpenText Method

    Loads and parses a text file as a new workbook with a single sheet that contains the parsed text-file data.

    Syntax

    expression.OpenText(Filename, Origin, StartRow, DataType, TextQualifier, ConsecutiveDelimiter, Tab, Semicolon, Comma, Space, Other, OtherChar, FieldInfo, DecimalSeparator, ThousandsSeparator)

    source

    and here's the Excel 2003 version:

    OpenText Method [Excel 2003 VBA Language Reference]

    Loads and parses a text file as a new workbook with a single sheet that contains the parsed text-file data.

    expression.OpenText(FileName, Origin, StartRow, DataType, TextQualifier, ConsecutiveDelimiter, Tab, Semicolon, Comma, Space, Other, OtherChar, FieldInfo, TextVisualLayout, DecimalSeparator, ThousandsSeparator, TrailingMinusNumbers, Local)

    source

    so Local was indeed a new parameter for Excel 2003 and won't work in Excel 2000

    No idea as to the cause of the erroneous behaviour. The Local parameter is defined as:

    Local Optional Variant. Specify True if regional settings of the machine should be used for separators, numbers and data formatting.

    You might want to double-check the regional settings on the Excel 2000 PC and check to see if there is anything which may cause the data to be wrongly interpreted. Also, try explicitly specifying the DecimalSeparator and ThousandsSeparator parameters on the Excel 2000 method and see if that helps

    0 讨论(0)
提交回复
热议问题