Option Explicit
Sub ImportDemo()
Dim fname$
Dim newworkb As Workbook
fname = ThisWorkbook.Path + "\file.txt"
Workbooks.OpenText Filename:=fname, _
Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, _
Tab:=True, Semicolon:=False, Comma:=False, Space:=False, _
Other:=False, DecimalSeparator:=".", ThousandsSeparator:=" ", _
FieldInfo:=Array(Array(1, 1), Array(2, 3), Array(3, 1), Array(4, 1))
Set newworkb = ActiveWorkbook
newworkb.Worksheets(1).Copy after:=ThisWorkbook.Worksheets(1)
newworkb.Close False
End Sub
|