Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Opening text file in Excel

Hi,

I am trying to open a text file in EXCEL 2000, How could
I substitute in FieldInfo:= if I have a variable fields.
Sample below is only 5 fields, What if I have more than 10
fields?.

Workbooks.OpenText FileName:=App.Path
& "\" "TestFile1.txt", Origin:= xlWindows, StartRow:=1,
DataType:=xlFixedWidth, FieldInfo:= Array(Array(0, 1),
Array(10, 1), Array(49, 1), Array(68, 1))

Appreciate very much your help.
Eric
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Opening text file in Excel

As an example, use something like:

Dim varr as Variant
varr = Array(Array(0, 1),
Array(10, 1), Array(49, 1), Array(68, 1))
redim Preserve Varr(lbound(varr) to ubound(varr)+1)
varr(ubound(varr)) = Array(79,1)

Workbooks.OpenText FileName:=App.Path
& "\" "TestFile1.txt", Origin:= xlWindows, StartRow:=1,
DataType:=xlFixedWidth, FieldInfo:= Varr


--
Regards,
Tom Ogilvy


"Eric" wrote in message
...
Hi,

I am trying to open a text file in EXCEL 2000, How could
I substitute in FieldInfo:= if I have a variable fields.
Sample below is only 5 fields, What if I have more than 10
fields?.

Workbooks.OpenText FileName:=App.Path
& "\" "TestFile1.txt", Origin:= xlWindows, StartRow:=1,
DataType:=xlFixedWidth, FieldInfo:= Array(Array(0, 1),
Array(10, 1), Array(49, 1), Array(68, 1))

Appreciate very much your help.
Eric



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
opening text file in excel problem jz193 Excel Discussion (Misc queries) 18 February 10th 06 02:42 PM
Opening a text file in excel Opyuse Excel Discussion (Misc queries) 4 June 13th 05 09:23 PM
Opening text file in Excel through macro Ed[_9_] Excel Programming 0 October 7th 03 04:13 PM
Opening text file in Excel through macro shockley Excel Programming 0 October 7th 03 03:49 PM
opening and write to a text file in excel julian brotherton Excel Programming 1 October 5th 03 11:13 PM


All times are GMT +1. The time now is 03:50 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"