I have a notepad file
I have to convert that file into .xls
Plz see i uploaded the notepad file
notepad file is located in C:\Users\**I've been banned**\Desktop\save it
Code: Select all
Sub Test()
myFile = Application.GetOpenFilename("Text Files, *.txt", , "abc def...")
If myFile = False Then Exit Sub
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & myFile, Destination:=Range("$A$1"))
.Name = "pipe"
.TextFilePlatform = 65001
.TextFileParseType = xlDelimited
.TextFileCommaDelimiter = True
.Refresh BackgroundQuery:=False
End With
End Sub
I need to remove get open filename(file path will be hardcoded in the macro & the data it has to paste is in another path & that path also should be hardcoded in the macro i.e C:\Users\**I've been banned**\Desktop\save it\book1.xls)
Plz note file path may be changed in future & it can be in different location & in different folder