Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
opening text file in excel problem | Excel Discussion (Misc queries) | |||
Opening a text file in excel | Excel Discussion (Misc queries) | |||
Opening text file in Excel through macro | Excel Programming | |||
Opening text file in Excel through macro | Excel Programming | |||
opening and write to a text file in excel | Excel Programming |