Results 1 to 7 of 7

Thread: Another QQ

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    123
    I am having trouble figuring out how to save the contents of a textbos as a text file to a specific location without prompting the user. Can anyone help?

  2. #2
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736
    Does this help ?

    Code:
    Private Sub Command1_Click()
        Open "c:\testfile.txt" For Output As #1
        Print #1, Text1.Text
        Close #1
    End Sub

  3. #3
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    I think using FreeFile is a handy method for remembering filenumbers, this is especially handy with multiple files:

    Code:
    Dim fn As FreeFile
    Open "file" for output as #fn
    Print #fn, text1.text
    Close 'this will close all open files, if you use Close #fn it will only close this file.
    And yes Jbart I think it helps (are you dutch?)
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  4. #4
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736
    Thanks Jop ! I keep forgetting about FreeFile. So far I have only written one program that needs multiple input and output statements for text files.



    Not dutch, Texan. Have some Swiss roots from back in the 1800's though.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    123
    I think that helps... let me see what I can do with it.

  6. #6
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    EEK!

    Code:
    Dim fn As Integer
    fn = FreeFile
    Open "file" for output as #fn
    Print #fn, text1.text
    Close 'this will close all open files, if you use Close #fn it will only close this file.
    This is the correct code!
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    123
    With a little adapting it does what is required... thanks to all.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width