I have problem in making this. format in a text file
Note: The text is only on A1, separated by a delimiter indicator which is "^"
https://docs.google.com/file/d/0B_eArBbGfxv4OTJ2YTlDaFBnZDA/edit?usp=sharing
To this . . . after text file multiple import to excel
As you can see in the image, all the text will be in one column which is A1.
https://docs.google.com/file/d/0B_eArBbGfxv4T3dpUnZaQlFVdVk/edit?usp=sharing
Here's the program I am working on:
Please Help. Thank you
Note: The text is only on A1, separated by a delimiter indicator which is "^"
https://docs.google.com/file/d/0B_eArBbGfxv4OTJ2YTlDaFBnZDA/edit?usp=sharing
To this . . . after text file multiple import to excel
As you can see in the image, all the text will be in one column which is A1.
https://docs.google.com/file/d/0B_eArBbGfxv4T3dpUnZaQlFVdVk/edit?usp=sharing
Here's the program I am working on:
Code:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim oFileDialog As FileDialog
Dim LoopFolderPath As String
Dim oFileSystem As FileSystemObject
Dim oLoopFolder As Folder
Dim oFilePath As File
Dim oFile As TextStream
Dim RowN As Long
Dim ColN As Long
Dim iAnswer As Integer
On Error GoTo ERROR_HANDLER
Set oFileDialog = Application.FileDialog(msoFileDialogFolderPicker)
RowN = 1
ColN = 1
With oFileDialog
If .Show Then
ActiveSheet.Columns(ColN).Cells.Clear
LoopFolderPath = .SelectedItems(1) & "\"
Set oFileSystem = CreateObject("Scripting.FileSystemObject")
Set oLoopFolder = oFileSystem.GetFolder(LoopFolderPath)
For Each oFilePath In oLoopFolder.Files
Set oFile = oFileSystem.OpenTextFile(oFilePath)
With oFile
Do Until .AtEndOfStream
ActiveSheet.Cells(RowN, ColN).Value = .ReadLine
LoopFolderPath = Space(1)
RowN = RowN + 1
Loop
.Close
End With
'oLoopFolderPath = Split(ActiveCell, "^")
'ActiveCell.Resize(UBound(oLoopFolderPath) + 1) = WorksheetFunction.Transpose(oLoopFolderPath)
ActiveSheet.Range("A:A").TextToColumns Destination:=Range("A1") _
, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, Other:=True _
, OtherChar:="^"
ActiveSheet.UsedRange.Columns.AutoFit
Next oFilePath
End If
iAnswer = MsgBox("Your Textfiles have been Inputted.", vbInformation)
End With
EXIT_SUB:
Set oFilePath = Nothing
Set oLoopFolder = Nothing
Set oFileSystem = Nothing
Set oFileDialog = Nothing
Application.ScreenUpdating = True
Exit Sub
ERROR_HANDLER:
Err.Clear
GoTo EXIT_SUB
End Sub
Please Help. Thank you
Last edited: