Hello,
I have written the below code to copy entire content of any .txt file into a excel sheet. Surprisingly, any comma "," found in the .txt file is being treated as a new line character while pasting in a work sheet. Could someone help me on how to stop the macro from treating a "," as a new line character?
Sub Open_File()
Dim strFile As String
With Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = ThisWorkbook.Path
If .Show <> -1 Then Exit Sub
strFile = .SelectedItems(1)
Open strFile For Input As #1
i = 1
Do While Not EOF(1) ' Loop until end of file.
Input #1, Text
Sheets("Workspace").Range("A" & i) = Text
i = i + 1
Loop
Close #1
End With
End Sub
Bookmarks