Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

creating non .txt files in vb6

  • 14-09-2005 07: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, Registered Users 2 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, Registered Users 2 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