Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
al al is offline
external usenet poster
 
Posts: 363
Default Open delimited file

I am modifying existing code to sit my purposes. The existing code loops
through a folder and opens files (xls) I need to modify to open a delimited
file.
The exisiting code will open the file but does not columnize the file.

Set mybook = Workbooks.Open(MyPath & MyFiles(Fnum))

I have this bit for opening the delimited file...

Workbooks.OpenText Filename:="G:\MyPath\MyFile.txt", Origin:=437
,StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote,
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False,
Space:=False, Other:=True, OtherChar:=":", FieldInfo:=Array(Array(1, 1),
Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1),
Array(8, 1),Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13,
1), Array(14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1),
Array(19, 1), Array(20, 1), Array(21, 1),Array(22, 1), Array(23, 1),
Array(24, 1), Array(25, 1), Array(26, 1), Array(27, 1), Array(28, 1),
Array(29, 1), Array(30, 1), Array(31, 1)), TrailingMinusNumbers:=True

How do I combine the two?
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Open delimited file

It looks if your code will open a text file (.txt) and parse the data
into seperate columns on each tab or colon ":" in the text file. If
there are no tabs or colon characters, all the data would remain in
column A.

I would only expect to see only one delimiter for the file, either the
tab or the colon.
Goshute
  #3   Report Post  
Posted to microsoft.public.excel.programming
al al is offline
external usenet poster
 
Posts: 363
Default Open delimited file

The second bit of code does open the text file in itself if I define the
path/file.

How do I add the delimited part to this line....Set mybook =
Workbooks.Open(MyPath & MyFiles(Fnum))



"goshute" wrote:

It looks if your code will open a text file (.txt) and parse the data
into seperate columns on each tab or colon ":" in the text file. If
there are no tabs or colon characters, all the data would remain in
column A.

I would only expect to see only one delimiter for the file, either the
tab or the colon.
Goshute
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Open delimited file

Dim fCtr as long
dim myBook as workbook
....get your list of .txt files in to myFiles().

for fctr = lbound(myfiles) to ubound(myfiles)
Workbooks.OpenText Filename:=myPath & myfiles(fctr), Origin:=437, _
...etc
set mybook = activeworkbook
'do whatever you want to continue processing mybook
mybook.worksheets(1).range("A1").value = "hi there!"
next fctr


Al wrote:

The second bit of code does open the text file in itself if I define the
path/file.

How do I add the delimited part to this line....Set mybook =
Workbooks.Open(MyPath & MyFiles(Fnum))

"goshute" wrote:

It looks if your code will open a text file (.txt) and parse the data
into seperate columns on each tab or colon ":" in the text file. If
there are no tabs or colon characters, all the data would remain in
column A.

I would only expect to see only one delimiter for the file, either the
tab or the colon.
Goshute
.


--

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
How do you keep coma delimited format when open csv youngd Setting up and Configuration of Excel 0 February 4th 10 01:48 PM
Converting Tab Delimited Text File to A Comma Delimited Text File Dave Peterson Excel Programming 0 June 13th 07 03:13 PM
Saving multi-tab excel file created from comma delimited text file Marcus Aurelius Excel Programming 2 December 19th 05 05:16 PM
Create a form to open a comma delimited file ~Rick Excel Discussion (Misc queries) 1 September 29th 05 08:25 PM
Open delimited text file to excel without changing data in that file zohanc Excel Programming 1 October 3rd 03 01:06 AM


All times are GMT +1. The time now is 04:09 PM.

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"