Importing Text into Excel - How to increase 8192 character limit per cell

I'm using VB to import text files into an Excel spreadsheet. 

VB as provided on this thread http://excelexperts.com/comment/reply/1611/2671 works great for that.

Some of the files are quite large - but I need them to go into a single cell.

However some of the text data is getting cutoff because of the 8192 character limit.

Is there anyway to edit something to increase the character limit per cell?

RE: Importing Text Into Excel

Hi, rapidasia,

The limit of characters of Excel's cell is a 32767 characters. The subroutine, which you use, read only the first line of the file, because I took too literally your requirements ("... single line...") and write it in that way. Your data is cut off, because somewhere in the text (probably after 8192 character) someone is press ENTER and thus did a new line. However, I changed the subroutine to meet your new requirements. The change is insignificantly, but I post the subroutine again for clarity. The change is bolded.

Here is the code:

' ******************** ' ******************** ' ******************** '
Sub ImportDataFromTxtFiles()

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

On Error GoTo ERROR_HANDLER

Set oFileDialog = Application.FileDialog(msoFileDialogFolderPicker)

RowN = 1
ColN = 3 ' Column C

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 = .ReadAll
                    RowN = RowN + 1
                Loop
               
                .Close
            End With
        Next oFilePath
    End If
End With

EXIT_SUB:
    Set oFilePath = Nothing
    Set oLoopFolder = Nothing
    Set oFileSystem = Nothing
    Set oFileDialog = Nothing
   
    Application.ScreenUpdating = True
   
    Exit Sub

ERROR_HANDLER:
    ' Some code for error handling
    Err.Clear
    GoTo EXIT_SUB

End Sub
' ******************** ' ******************** ' ******************** '

 

Best regards.

Fantastic, thanks.

Fantastic, thanks.