hi
if you like to import the delimited text file into excel Vba
Here is the code
Sub delimit_txt_file()
Dim swa As Workbook
Dim textfilename As Variant
textfilename = Application.GetOpenFilename _
(FileFilter:="Text Files (*.txt), *.txt", _
Title:="Select File To Be Opened")
'---- set true as per your requirement and change the charater in other if required
Workbooks.OpenText Filename:=textfilename, Origin:=xlWindows, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False _
, Space:=False, Other:=True, OtherChar:="|"
Set swa = ActiveWorkbook
' -----
' here you can save the workbook or do formating etc..
end sub
No comments:
Post a Comment