adding the text box output to a txt file or excel sheet

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rene20
    New Member
    • Dec 2006
    • 1

    adding the text box output to a txt file or excel sheet

    Please help

    im new at VB & programming in general, and im creating a program to output the text to a excel sheet or to a normal text file, in wordpad, the design of the program is 100% but i have no clue on how to go about going about this, could someone please help this dummie!!!

    and i know im trying my luck here, but i also need to find out how to make the program work in such a way that, each time someone opens it, a Unique code is generated. even if its like 01, 02 , 03 , 04, 05, 06,etc

    Please help again, thank you
  • padhuwork
    New Member
    • Dec 2006
    • 30

    #2
    Originally posted by rene20
    Please help

    im new at VB & programming in general, and im creating a program to output the text to a excel sheet or to a normal text file, in wordpad, the design of the program is 100% but i have no clue on how to go about going about this, could someone please help this dummie!!!

    and i know im trying my luck here, but i also need to find out how to make the program work in such a way that, each time someone opens it, a Unique code is generated. even if its like 01, 02 , 03 , 04, 05, 06,etc

    Please help again, thank you
    You can use FileSystemObjec t and TextStream to get this done. Add Scripting Runtime refrence.

    You can use Filesystemobjec t to create a text file or an excel file (preferably a CSV file) and your textstream for writing lines to the text file. If you are using a CSV file output format, use comma(,) as seperator.

    Dim fsr As New FileSystemObjec t
    Dim rsLog As TextStream
    fsr.CreateTextF ile (SaveFileName) ' SaveFilename specify the path where you would like to save the file, you can use commondialog control
    Set rsLog = fsr.OpenTextFil e(LogFileName, ForReading)

    rslog.WriteLine ("your text goes here")

    finally after you are done,
    close the file.

    rslog.Close


    All the best!
    Padhu

    Comment

    • padhuwork
      New Member
      • Dec 2006
      • 30

      #3
      Originally posted by padhuwork
      You can use FileSystemObjec t and TextStream to get this done. Add Scripting Runtime refrence.

      You can use Filesystemobjec t to create a text file or an excel file (preferably a CSV file) and your textstream for writing lines to the text file. If you are using a CSV file output format, use comma(,) as seperator.

      Dim fsr As New FileSystemObjec t
      Dim rsLog As TextStream
      fsr.CreateTextF ile (SaveFileName) ' SaveFilename specify the path where you would like to save the file, you can use commondialog control
      Set rsLog = fsr.OpenTextFil e(LogFileName, ForReading)

      rslog.WriteLine ("your text goes here")

      finally after you are done,
      close the file.

      rslog.Close


      All the best!
      Padhu

      Add "Microsoft Scripting Runtime" from your References

      Comment

      • mharry
        New Member
        • Dec 2006
        • 5

        #4
        Originally posted by padhuwork
        Add "Microsoft Scripting Runtime" from your References
        I'm no expert but you can't use fso and open a file for reading and then write to it. You can only write to a file by opening it to write or append. You can however read the file (or line) into a var. and then close the file and write the contents to another file.
        -m

        Comment

        • padhuwork
          New Member
          • Dec 2006
          • 30

          #5
          Originally posted by mharry
          I'm no expert but you can't use fso and open a file for reading and then write to it. You can only write to a file by opening it to write or append. You can however read the file (or line) into a var. and then close the file and write the contents to another file.
          -m
          thanks harry... i was reading and writing to same file. Instead, what can be done, you can write to a temp file from the original and then delete of the orginal and rename the created to the original name. as such, reading and writing on same file is not possible at the same time

          Comment

          Working...