UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Custom Search
Edit Discussion
> FileToString    

This function reads lines from a text-based file and returns the in a VBA string.

See also: FileToByteArray


' FileToString
' http://www.utteraccess.com/wiki/index.php/FileToString
' Code courtesy of UtterAccess Wiki
' Licensed under Creative Commons License
' http://creativecommons.org/licenses/by-sa/3.0/
' You are free to use this code in any application,
' provided this notice is left unchanged.
' rev  date                          brief descripton
' 1.0  2012-01-17                    
Public Function FileToString(SourceFile As String) As String
 'prelim, no validations yet
 Dim i As Integer
 Dim s As String
 i = FreeFile
 Open SourceFile For Input As #i
   s = Input(LOF(i), i)
 Close #i
 FileToString = s
End Function

Creative Commons License
FileToString by UtterAccess Wiki is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Editing and revision of the content is freely encouraged; for details, see Expected Usage.

Edit Discussion
Custom Search

Thank you for your support!
This page has been accessed 13,073 times.  This page was last modified 02:36, 12 May 2012 by Jack Leach.   Disclaimers