Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
txt tab-delimited to CSV
We use a program which is only able to export data into 'tab- delimited' text files. We need data from this program to go to another which can only read CSV files. Is there a way to script this so it automatically converts the contents of a text file to a csv which can be opened in excel? Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
txt tab-delimited to CSV
Hi,
XL is also able to open tab delimited files, but you have to open them via XL. What file format do you want to convert ? Regards JY wrote in message oups.com... We use a program which is only able to export data into 'tab- delimited' text files. We need data from this program to go to another which can only read CSV files. Is there a way to script this so it automatically converts the contents of a text file to a csv which can be opened in excel? Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
txt tab-delimited to CSV
On 7 Mar, 11:36, "Jean-Yves" wrote:
Hi, XL is also able to open tab delimited files, but you have to open them via XL. What file format do you want to convert ? Regards wrote in message oups.com... We use a program which is only able to export data into 'tab- delimited' text files. We need data from this program to go to another which can only read CSV files. Is there a way to script this so it automatically converts the contents of a text file to a csv which can be opened in excel? Thanks- Hide quoted text - - Show quoted text - Thanks for replying. Yes, i am aware XL can open tab-delimited but we need the process automated so no user intervention is required. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
txt tab-delimited to CSV
ok, But what is the file format, eg .txt ?
JY wrote in message ps.com... On 7 Mar, 11:36, "Jean-Yves" wrote: Hi, XL is also able to open tab delimited files, but you have to open them via XL. What file format do you want to convert ? Regards wrote in message oups.com... We use a program which is only able to export data into 'tab- delimited' text files. We need data from this program to go to another which can only read CSV files. Is there a way to script this so it automatically converts the contents of a text file to a csv which can be opened in excel? Thanks- Hide quoted text - - Show quoted text - Thanks for replying. Yes, i am aware XL can open tab-delimited but we need the process automated so no user intervention is required. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
txt tab-delimited to CSV
On 7 Mar, 11:55, "Jean-Yves" wrote:
ok, But what is the file format, eg .txt ? wrote in message ps.com... On 7 Mar, 11:36, "Jean-Yves" wrote: Hi, XL is also able to open tab delimited files, but you have to open them via XL. What file format do you want to convert ? Regards wrote in message groups.com... We use a program which is only able to export data into 'tab- delimited' text files. We need data from this program to go to another which can only read CSV files. Is there a way to script this so it automatically converts the contents of a text file to a csv which can be opened in excel? Thanks- Hide quoted text - - Show quoted text - Thanks for replying. Yes, i am aware XL can open tab-delimited but we need the process automated so no user intervention is required.- Hide quoted text - - Show quoted text - sorry, the tab-delimited is in text (txt) format.. and it is required to be in CSV format. :) |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
txt tab-delimited to CSV
|
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
txt tab-delimited to CSV
Maybe something like this:
Option Explicit Sub testme01() Dim myFileNames As Variant Dim myArray() As Variant Dim iCtr As Long Dim maxFields As Long Dim wkbk As Workbook Dim NewFileName As String maxFields = Worksheets(1).Columns.Count myFileNames = Application.GetOpenFilename _ (filefilter:="Text Files, *.txt", MultiSelect:=True) If IsArray(myFileNames) = False Then Exit Sub 'user hit cancel End If ReDim myArray(1 To maxFields, 1 To 2) For iCtr = 1 To maxFields myArray(iCtr, 1) = iCtr 'bring it in as text--so nothing changes myArray(iCtr, 2) = xlTextFormat Next iCtr For iCtr = LBound(myFileNames) To UBound(myFileNames) Workbooks.OpenText Filename:=myFileNames(iCtr), _ StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _ ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _ Comma:=False, Space:=False, Other:=False, _ FieldInfo:=myArray If LCase(Right(myFileNames(iCtr), 4)) = ".txt" Then NewFileName = Left(myFileNames(iCtr), Len(myFileNames(iCtr)) - 4) End If NewFileName = NewFileName & ".csv" Set wkbk = ActiveWorkbook 'overwrite any existing .csv file Application.DisplayAlerts = False wkbk.SaveAs Filename:=NewFileName, FileFormat:=xlCSV Application.DisplayAlerts = True wkbk.Close savechanges:=False Next iCtr End Sub wrote: We use a program which is only able to export data into 'tab- delimited' text files. We need data from this program to go to another which can only read CSV files. Is there a way to script this so it automatically converts the contents of a text file to a csv which can be opened in excel? Thanks -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Saving as tab delimited or comma delimited | Excel Discussion (Misc queries) | |||
CSV Tab Delimited | Excel Discussion (Misc queries) | |||
space delimited files now tab delimited | Excel Discussion (Misc queries) | |||
Tab delimited to comma delimited | Excel Worksheet Functions | |||
How can I convert tab delimited files to pipe delimited? | Excel Discussion (Misc queries) |