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 |
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 |
All times are GMT +1. The time now is 03:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com