By using vba.booksticle.com you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

948 Steps to 6 Figures by Learning Excel-VBA and Other Skills



Step 352 - LoadFileToString(sFile) - udf



Function LoadFiletoString(sFile As String)

If dir(sFile) = "" then
    Msgbox  sFile & " doesn't exist, can't load data"
    End
End If

x = bOpenSeqFile(sFile,"I")
if x < 0 then
    Msgbox "Error " & x & " opening file " & sFile & " " & Error(abs(x))
    End
End if

Line Input #x,s
strrec = s & vbCRLF
Do while not eof(x)
    Line input #x, s
    strRec = strRec & s & vbCRLF

Loop
Close #x
LoadFiletoString = strrec
End Function

   Table of Contents | Send us your feedback | © 2025 All Rights Reserved | Edit