antaeusguy
Board Regular
- Joined
- Mar 8, 2010
- Messages
- 81
hi
I've several text file which I would want to import into Excel and each text file has different columns
I noted I could use Workbooks.OpenText and the property to change which columns to import and it's import format is FieldInfo.
I declared a variable called arrtext and this will change from file to file. I intended to use arrtext as the FieldInfo.
I tried the code below but is does not work.
Does anyone knows how to declare the variable for FieldInfo in .OpenText? Thanks a lot!
I've several text file which I would want to import into Excel and each text file has different columns
I noted I could use Workbooks.OpenText and the property to change which columns to import and it's import format is FieldInfo.
I declared a variable called arrtext and this will change from file to file. I intended to use arrtext as the FieldInfo.
I tried the code below but is does not work.
Does anyone knows how to declare the variable for FieldInfo in .OpenText? Thanks a lot!
Code:
Sub TextImportTest()
Dim arrtext As String
arrtext = "Array(Array(1, 1), Array(2, 2), Array(3, 9))"
Workbooks.OpenText Filename:="C:\Users\john.doe\Desktop\test\test.txt", _
Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
Comma:=False, Space:=False, Other:=False, FieldInfo:=arrtext, TrailingMinusNumbers:=True
End Sub