You can store upto 2 Billion Characters in a String Variable, you will need to change the method of Loading the File into the Variable for Larger Files though, ie.
------------------Code:Private Sub Command1_Click() Dim sData As String Dim sChunk As String Dim lChunk As Long Dim lFileLen As Long Dim iFile As Integer iFile = FreeFile 'Open File For Binary Access Open "C:\TestFile.csv" For Binary Access Read As iFile lFileLen = LOF(iFile) lChunk = 64000 'Load File in 64K Chunks While Loc(iFile) < lFileLen 'Make sure the Buffer isn't Too Big If Loc(iFile) + lChunk > lFileLen Then lChunk = lFileLen - Loc(iFile) sChunk = Space(lChunk) 'Get the Next Chunk of Data Get #iFile, , sChunk 'Append it to the Rest sData = sData & sChunk Wend Close iFile MsgBox "Done" End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]




Reply With Quote