I have used the below code to import textfile to excel. But there is a line break in my 6th line of textfile because of which the data below the 6th line in textpad is not importing to excel file. Can anyone please help on this.
With application.filedialog(msofiledialogfolderpicker)
.title ="select folder"
.allowmultiselect=false
Selectfolder = .selecteditems(1)& "\"
Opentextfile = dir(select folder)
Do while opentextfile <>"
Workbooks.opentext filename:=selectfolder & "" & opentextfile
Importworkbook = activeworkbook
Set Wsheet = Thisworkbook.worksheets("sheet1")
Importworkbook.worksheets(1).range("A1).currentregion.copy Wsheet.range("A1")
Importworkbook.close true
...
...
Thank you in advance.
With application.filedialog(msofiledialogfolderpicker)
.title ="select folder"
.allowmultiselect=false
Selectfolder = .selecteditems(1)& "\"
Opentextfile = dir(select folder)
Do while opentextfile <>"
Workbooks.opentext filename:=selectfolder & "" & opentextfile
Importworkbook = activeworkbook
Set Wsheet = Thisworkbook.worksheets("sheet1")
Importworkbook.worksheets(1).range("A1).currentregion.copy Wsheet.range("A1")
Importworkbook.close true
...
...
Thank you in advance.