> ReadTextFile    


Synopsis

open a text file and load the contents into a string that is returned. PARAMETER: psPathFile is the path and filename to open and read.

CODE
' ReadTextFile
' http://www.utteraccess.com/wiki/ReadTextFile
' 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  2019-07-16                    
'
'*************** Code Start *****************************************************
' Purpose  : Read the contents of a text file to a string
' Return   : String
'--------------------------------------------------------------------------------
'                              ReadTextFile
'--------------------------------------------------------------------------------
Public Function ReadTextFile (psPathFile As String) As String
  Dim iFile As Integer _
     , sFileContents As String
  iFile = FreeFile
  Open psPathFile For Input As iFile
  sFileContents = Input(LOF(iFile), iFile)
  Close iFile
  ReadTextFile = sFileContents
End Function
'*************** Code End *******************************************************

Creative Commons License
ReadTextFile 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.