Generating .txt files using LotusScript

How can I create text (.txt) files using LotusScript?  The file should be populated with field values from a form.  Then emailed as an attachment and/or stored on a specific folder on the network server(s).
Examples and/or web resources would be extremely useful.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

An example :

     ' Declarations
     Dim session As New NotesSession
     Dim uiws As New NotesUIWorkspace
     Dim db As NotesDatabase    
     Dim collection As NotesDocumentCollection    
     Dim doc, parameterDoc, begleitDoc As NotesDocument
     Dim tempItem As NotesItem
     Dim i,j As Integer
     Dim intFile As Integer    
     ' Dataset to write
     Dim Dataset (1 To 25) As String
     VarAGesamt, VarBGesamt  as String

     On Error Goto Fehler ' catch errors
     ' Init
     Set db = session.CurrentDatabase
     Set collection = db.UnprocessedDocuments    
     Set parameterDoc = db.GetProfileDocument("Parameter")
    ' Erstelle File
     intFile = Freefile()    
     Open "A:\File.txt" For Output Access Write Lock Read Write As intFile
     ' Init Dataset A
      Dataset(1) = "..."    
      Dataset(2) = "..."
      Dataset(14) = "..."
     For i = 1 To 14
          VarAGesamt = VarAGesamt+Datensatz(i)
    ' write Dataset A
     Print #intFile, VarAGesamt;
    ' Init Dataset B with all selected docs
     For i = 1 To collection.Count
          Set doc = collection.GetNthDocument( i )
          Set tempItem = doc.GetFirstItem("Zahlungsart")
               Datensatz(1) = "0245"
               Datensatz(2) = tempItem.Values(0)

               For j = 1 To 25
                    VarCGesamt = VarCGesamt+Datensatz(j)
              ' write Dataset C
               Print #intFile, VarCGesamt;
               VarCGesamt = ""
          End If
      ' close File
     Close intFile
    Exit Sub
error :
     Msgbox "..."

     '  close File
     Close intFile
     Exit Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ah, I forgot to say that I had the code in an agent and called it over a button.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.