title: Text file from resource file
body: <p>I have a text file which I want to include in the resource file in my project</p>
  
  <p>Right now I have included the text file via "Add Custom Resource".</p>
  
  <p>When I run the project I read out the file from the resource file and save it to a tempory file.</p>
  
  <pre><code>LoadDataIntoFile "TXT", App.Path &amp; "\temp.txt"
  </code></pre>
  
  <p>This uses the following function</p>
  
  <pre><code>Public Sub LoadDataIntoFile(DataName As String, FileName As String)
    Dim myArray() As Byte
    Dim myFile As Long
    If Dir(FileName) = "" Then
      myArray = LoadResData(DataName, "CUSTOM")
      myFile = FreeFile
      Open FileName For Binary Access Write As #myFile
      Put #myFile, , myArray
      Close #myFile
    End If
  End Sub
  </code></pre>
  
  <p>Next, when I need the text file data I read in the temporay file</p>
  
  <pre><code>'read complete text file
  intFile = FreeFile
  Open strFile For Input As #intFile
    strData = Input(LOF(intFile), #intFile)
  Close #intFile
  </code></pre>
  
  <p>I then can use the data from the text file without any problems.</p>
  
  <p>It seems a bit awkward though to first read the data, then save to file, and then read the data from file</p>
  
  <p>Is there a way to inlcude a text file in the resource file, and read it directly into a string variable when I need it?</p>