+ Reply to Thread
Results 1 to 2 of 2

Opening a csv file

  1. #1
    Registered User
    Join Date
    06-03-2005
    Posts
    4

    Opening a csv file

    Hello,

    I have som trouble by opening a csv file: if I do it normally in Excel with File/Open, then it works fine and I get the date in 4 columns (AbJahrMonat in A, Code in B, Name in C and Wert in D):

    AbJahrMonat Code Name Wert
    200507 P01 Produkt1 0,0225

    I registred the generated macro, it looks like this:
    die entsrechende Makro habe ich registriert, es sieht so aus:

    Sub Macro1()
    '
    ' Macro1 Macro
    ' Macro enregistrée le 05/10/2005 par Olivier
    '

    '
    ChDir "C:\temp"
    Workbooks.Open Filename:="C:\temp\myfile.csv"
    End Sub

    After the registration, if I run the macro, for example with F5, then it doesn't work the way I wish; it looks like this (everything in column A):

    AbJahrMonat;Code;Name;Wert;
    200507;P01;Produkt1;0 0225;

    How can I do to automatically get the data in 4 columns by open ?

    Thanks you.

    Olivier



  2. #2
    Patrick Molloy
    Guest

    RE: Opening a csv file

    Workbooks.Open "C:\temp\myfile.csv", 2

    this is very clear in HELP on the workbook OPEN item. The second parameter
    is the format.

    "oli" wrote:

    >
    > Hello,
    >
    > I have som trouble by opening a csv file: if I do it normally in Excel
    > with File/Open, then it works fine and I get the date in 4 columns
    > (AbJahrMonat in A, Code in B, Name in C and Wert in D):
    >
    > AbJahrMonat Code Name Wert
    > 200507 P01 Produkt1 0,0225
    >
    > I registred the generated macro, it looks like this:
    > die entsrechende Makro habe ich registriert, es sieht so aus:
    >
    > Sub Macro1()
    > '
    > ' Macro1 Macro
    > ' Macro enregistrée le 05/10/2005 par Olivier
    > '
    >
    > '
    > ChDir "C:\temp"
    > Workbooks.Open Filename:="C:\temp\myfile.csv"
    > End Sub
    >
    > After the registration, if I run the macro, for example with F5, then
    > it doesn't work the way I wish; it looks like this (everything in
    > column A):
    >
    > AbJahrMonat;Code;Name;Wert;
    > 200507;P01;Produkt1;0 0225;
    >
    > How can I do to automatically get the data in 4 columns by open ?
    >
    > Thanks you.
    >
    > Olivier
    >
    >
    >
    >
    >
    > --
    > oli
    > ------------------------------------------------------------------------
    > oli's Profile: http://www.excelforum.com/member.php...o&userid=24000
    > View this thread: http://www.excelforum.com/showthread...hreadid=473677
    >
    >


+ 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