Windows Vista Forums

Re: merge CSV to excel

  1. #1


    Tom Lavedas Guest

    Re: merge CSV to excel

    On Oct 22, 12:35*pm, "Ammy" <vbsstr...@xxxxxx> wrote:

    > Can anybody help me withe this script.
    > I want comma seperated files (; ) import it to excel.
    >
    > The script is ok but the data could not split in the rows, i must change
    > that in excel.
    > Like Extra >>Text to coloms.
    >
    > Thanks,
    >
    > Ammy
    >
    > filename001.csv
    > -----------------
    > data;data;data;data;data;data
    > data;data;data;data;data;data
    > data;data;data;data;data;data
    >
    > Here is the script :
    >
    Since your file is NOT comma delimited, their are only two things I
    can think to do; change the delimiter in the file to commas or use an
    Excel data import in place of the open. Here is a macro I recorded in
    Excel, with the extra bits stripped out and some other changes to make
    it VBS compatible. Its up to you to install in in your script ...

    Sub Macro2()
    '
    ' Macro2 Macro
    ' Macro recorded 10/22/2008 by Tom Lavedas
    '
    sFileSpec = "C:\Someplaceuseful\test.csv"
    With ActiveSheet.QueryTables.Add("TEXT;" & sFileSpec, Range("A1"))
    .AdjustColumnWidth = True
    .TextFileStartRow = 1
    .TextFileParseType = 1 ' xlDelimited
    .TextFileSemicolonDelimiter = True
    .Refresh BackgroundQuery:=False
    End With
    End Sub

    Tom Lavedas
    ===========
    http://members.cox.net/tglbatch/wsh/

      My System SpecsSystem Spec

  2. #2


    Luuk Guest

    Re: merge CSV to excel

    Tom Lavedas schreef:

    > On Oct 22, 12:35 pm, "Ammy" <vbsstr...@xxxxxx> wrote:

    >> Can anybody help me withe this script.
    >> I want comma seperated files (; ) import it to excel.
    >>
    >> The script is ok but the data could not split in the rows, i must change
    >> that in excel.
    >> Like Extra >>Text to coloms.
    >>
    >> Thanks,
    >>
    >> Ammy
    >>
    >> filename001.csv
    >> -----------------
    >> data;data;data;data;data;data
    >> data;data;data;data;data;data
    >> data;data;data;data;data;data
    >>
    >> Here is the script :
    >>
    >
    > Since your file is NOT comma delimited, their are only two things I
    CSV is the commonly known name for comma delimited, or not?

    > can think to do; change the delimiter in the file to commas or use an
    > Excel data import in place of the open. Here is a macro I recorded in
    > Excel, with the extra bits stripped out and some other changes to make
    > it VBS compatible. Its up to you to install in in your script ...
    >
    > Sub Macro2()
    > '
    > ' Macro2 Macro
    > ' Macro recorded 10/22/2008 by Tom Lavedas
    > '
    > sFileSpec = "C:\Someplaceuseful\test.csv"
    > With ActiveSheet.QueryTables.Add("TEXT;" & sFileSpec, Range("A1"))
    > .AdjustColumnWidth = True
    > .TextFileStartRow = 1
    > .TextFileParseType = 1 ' xlDelimited
    > .TextFileSemicolonDelimiter = True
    the line above makes it semicolondelimited ... ;-)


    > .Refresh BackgroundQuery:=False
    > End With
    > End Sub
    >
    > Tom Lavedas
    > ===========
    > http://members.cox.net/tglbatch/wsh/


    --
    Luuk

      My System SpecsSystem Spec

  3. #3


    Luuk Guest

    Re: merge CSV to excel

    Luuk schreef:

    > Tom Lavedas schreef:

    >> On Oct 22, 12:35 pm, "Ammy" <vbsstr...@xxxxxx> wrote:

    >>> Can anybody help me withe this script.
    >>> I want comma seperated files (; ) import it to excel.
    >>>
    >>> The script is ok but the data could not split in the rows, i must change
    >>> that in excel.
    >>> Like Extra >>Text to coloms.
    >>>
    >>> Thanks,
    >>>
    >>> Ammy
    >>>
    >>> filename001.csv
    >>> -----------------
    >>> data;data;data;data;data;data
    >>> data;data;data;data;data;data
    >>> data;data;data;data;data;data
    >>>
    >>> Here is the script :
    >>>
    >>
    >> Since your file is NOT comma delimited, their are only two things I
    >
    > CSV is the commonly known name for comma delimited, or not?
    >

    >> can think to do; change the delimiter in the file to commas or use an
    >> Excel data import in place of the open. Here is a macro I recorded in
    >> Excel, with the extra bits stripped out and some other changes to make
    >> it VBS compatible. Its up to you to install in in your script ...
    >>
    >> Sub Macro2()
    >> '
    >> ' Macro2 Macro
    >> ' Macro recorded 10/22/2008 by Tom Lavedas
    >> '
    >> sFileSpec = "C:\Someplaceuseful\test.csv"
    >> With ActiveSheet.QueryTables.Add("TEXT;" & sFileSpec, Range("A1"))
    >> .AdjustColumnWidth = True
    >> .TextFileStartRow = 1
    >> .TextFileParseType = 1 ' xlDelimited
    >> .TextFileSemicolonDelimiter = True
    >
    > the line above makes it semicolondelimited ... ;-)
    >
    >

    >> .Refresh BackgroundQuery:=False
    >> End With
    >> End Sub
    >>
    >> Tom Lavedas
    >> ===========
    >> http://members.cox.net/tglbatch/wsh/
    >
    >
    >

    oh, i forgot to mention that ist quit common in the Netherlands to have
    semicolon separated files because we do everything with a decimal comma

    so 2/3 is not 0.6666667 but is 0,6666667

    --
    Luuk

      My System SpecsSystem Spec

Re: merge CSV to excel

Similar Threads
Thread Forum
Mail Merge from Excel - issues
Hello, I have a good working knowledge of mail merge. I am trying to mail merge from Excel 2007 to Word 2007 onto mailing lables. When I complete...
Software
mail merge from excel doc
i know how to do a mail merge to create labels, but am having a difficult time doing it in Vista, which is new to me. can anyone help, please?
Vista General
running Excel Macro in in specified Excel files in spe
I have created a macro that works perfectly. I have to run that macro for 2000 employees. Can anyone help me to create a process to run this ...
PowerShell
create Excel spreadsheet without loading Excel
Greetings, I have a script which uses CreateObject("Excel.Application") to create a spreadsheet. This works fine on my machine since I have Excel...
VB Script
Word&Excel:Add-Edit Toolbar&Buttons:Autocorrect to Excel Toolbar!!
OK, I give up!!! How do I create a new toolbar? How do I edit the Toolbar Command Buttons (Icons?)? How do I create and add an Autocorrect (AC)...
Vista General
How to view Excel document without Microsoft Office Excel installe
I bought new PC of Vista Home edition. I can't view a Excel made document that was sent to me by friend because my new visa PC has no Microsoft...
Vista General
Vista ASP.NET 2.0 Cannot open Excel File using Microsoft.Excel 12.0 COM object
I am using an ASP.NET 2.0 web application using the Interop assembly pointing to the Microsoft.Excel 12.0 COM to open and write to a spreadsheet. ...
Software