Friday, March 4, 2011

vb6 Open File For Append issue Path Not Found

Open App.Path & "\Folder\" & str(0) For Output

Seems to get a path not found however if directly before that I do

MsgBox App.Path & "\Folder\" & str(0)

It Provides the correct directory/filename that I want

and if I replace that string with the direct path in quotes it works fine however that won't be very good for other users of my app :( Anyone know why this doesn't work?

From stackoverflow
  • You can open a file that doesn't exist. I tried it with:

      Open "c:\temp\test.txt" & Str(0) For Output As #1
      Close #1
    

    When it ran it created c:\temp\test.txt 0

    Note that I added "As #1" to the Open statement, and taht Str(0) adds a leading space for the optional minus sign (CStr(0) doens't add a leading space)

  • Comment: You can open a file that doesn't exist.

    Only true if your folder exist. If both your folder and file does not exist, it will give a "path not found" error.

0 comments:

Post a Comment