vb6 Open File For Output doesn't work in Vista

Posted on 2007-10-01
Last Modified: 2008-01-09
In Visual Basic 6.0, I have written a subroutine that creates a new text file using the command "open [file name] for output  as [#FileNumber]", then writes data to the file using the "Print" command.

This works in all versions of windows except Vista, where it simply does not create the text file, without any error messages.

Thanks for your help!
Question by:ttobin333
    LVL 7

    Accepted Solution

    What is the path of the file?
    The program may not have write privileges where you are trying to write to.

    Are you sure  you are not getting an error and just supressing it in VB?
    LVL 24

    Expert Comment

    Also what flavor is Vista ?

    Author Comment

    For file path, I tried application path and c:\. Which path would be safest to use?

    Vista flavor is Home Premium.

    Author Comment

    I experimented with file locations and in the end created a new folder off of C:\, where I targeted the output file. It worked. I should have guessed that Vista didn't like me tampering with the program files folder and root directory...but XP didn't mind at all!


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
    Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now