Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 253
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 253
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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.
:)



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving as tab delimited or comma delimited MathGrace Excel Discussion (Misc queries) 0 June 20th 08 08:02 PM
CSV Tab Delimited AronS Excel Discussion (Misc queries) 4 April 10th 08 08:01 PM
space delimited files now tab delimited Sunny Scripter Excel Discussion (Misc queries) 0 March 31st 08 12:39 AM
Tab delimited to comma delimited Arne Hegefors Excel Worksheet Functions 3 December 13th 07 03:08 PM
How can I convert tab delimited files to pipe delimited? Jeremy Town Excel Discussion (Misc queries) 2 November 15th 07 04:29 PM


All times are GMT +1. The time now is 08:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"