Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

creating non .txt files in vb6

Options
  • 14-09-2005 8:16pm
    #1
    Closed Accounts Posts: 5,284 ✭✭✭


    Open szFileName For Output As #2
    

    When this is passed a string such as "test.abc", for example, it creates a file "test.txt" instead of using the extension I want. Why is this happening please?


Comments

  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    for vb6 you have to specify the filetype before hand but I forget the command. :/


  • Closed Accounts Posts: 5,284 ✭✭✭pwd


    It was saving correctly after all, but this computer was displaying the file type as text files (wrongly).


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Try using the streams instead? eg.
    Set FileSys = CreateObject("Scripting.FileSystemObject")
    Set outStream = FileSys.CreateTextFile(outFile, OverwriteIfExist, OpenAsASCII)
    Do
    	outStream.WriteLine textLine
    Loop Until inStream.AtEndOfStream ' change to whatever.
    outStream.Close
    


  • Closed Accounts Posts: 5,284 ✭✭✭pwd


    sorry I meant that it was working already - the PC I was using had weird file associations that made it look like it wasn't at first.


Advertisement